LAMP
From KevinWiki
(Difference between revisions)
(New page: Category:Linux APM in web application development normally stands for 'Apache Web Server, PHP and MySQL.' This i...) |
(→= Change Charset) |
||
(5 intermediate revisions not shown) | |||
Line 6: | Line 6: | ||
== Install Apache Web Server == | == Install Apache Web Server == | ||
<pre> | <pre> | ||
- | $ sudo apt-get install apache2 | + | $ sudo apt-get install apache2 |
</pre> | </pre> | ||
Line 12: | Line 12: | ||
== Install MySQL Database == | == Install MySQL Database == | ||
<pre> | <pre> | ||
- | $ sudo apt-get install mysql-server | + | $ sudo apt-get install mysql-server |
</pre> | </pre> | ||
- | === | + | === Configuration === |
- | - | + | -open <code>/etc/mysql/my.cnf</code> file |
+ | |||
+ | ==== Change Charset === | ||
+ | -add '''<code>default-character-set=utf8</code>''' | ||
user = mysql | user = mysql | ||
Line 32: | Line 35: | ||
[mysql] | [mysql] | ||
- | #no-auto-rehash # faster start of mysql but no tab | + | #no-auto-rehash # faster start of mysql but no tab completion |
'''default-character-set=utf8''' | '''default-character-set=utf8''' | ||
+ | * For 5.5 | ||
+ | [mysqld] | ||
+ | # ... | ||
+ | collation-server = utf8_unicode_ci | ||
+ | init-connect='SET NAMES utf8' | ||
+ | character-set-server = utf8 | ||
+ | -After adding these two lines, the result of the following command | ||
+ | mysql> show variables like '%character%'; | ||
+ | should be changed from | ||
+ | +--------------------------+----------------------------+ | ||
+ | | Variable_name | Value | | ||
+ | +--------------------------+----------------------------+ | ||
+ | | character_set_client | '''latin1''' | | ||
+ | | character_set_connection | '''latin1''' | | ||
+ | | character_set_database | '''latin1''' | | ||
+ | | character_set_filesystem | binary | | ||
+ | | character_set_results | '''latin1''' | | ||
+ | | character_set_server | '''latin1''' | | ||
+ | | character_set_system | utf8 | | ||
+ | | character_sets_dir | /usr/share/mysql/charsets/ | | ||
+ | +--------------------------+----------------------------+ | ||
+ | 8 rows in set (0.00 sec) | ||
+ | to | ||
+ | +--------------------------+----------------------------+ | ||
+ | | Variable_name | Value | | ||
+ | +--------------------------+----------------------------+ | ||
+ | | character_set_client | '''utf8''' | | ||
+ | | character_set_connection | '''utf8''' | | ||
+ | | character_set_database | '''utf8''' | | ||
+ | | character_set_filesystem | binary | | ||
+ | | character_set_results | '''utf8''' | | ||
+ | | character_set_server | '''utf8''' | | ||
+ | | character_set_system | utf8 | | ||
+ | | character_sets_dir | /usr/share/mysql/charsets/ | | ||
+ | +--------------------------+----------------------------+ | ||
+ | 8 rows in set (0.00 sec) | ||
+ | ==== Change Default Database Engine to InnoDB ==== | ||
+ | - add '''<code>default-storage-engine</code>''' | ||
+ | |||
+ | # * InnoDB | ||
+ | # | ||
+ | # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. | ||
+ | # Read the manual for more InnoDB related options. There are many! | ||
+ | # | ||
+ | # * Security Features | ||
+ | # | ||
+ | # Read the manual, too, if you want chroot! | ||
+ | # chroot = /var/lib/mysql/ | ||
+ | # | ||
+ | # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". | ||
+ | # | ||
+ | # ssl-ca=/etc/mysql/cacert.pem | ||
+ | # ssl-cert=/etc/mysql/server-cert.pem | ||
+ | # ssl-key=/etc/mysql/server-key.pem | ||
+ | |||
+ | '''default-storage-engine=InnoDB''' | ||
+ | |||
+ | -After changing it, the result of the following command should be changed | ||
+ | mysql> show variables like '%storage_engine%'; | ||
+ | from | ||
+ | +----------------+--------+ | ||
+ | | Variable_name | Value | | ||
+ | +----------------+--------+ | ||
+ | | storage_engine | '''MyISAM''' | | ||
+ | +----------------+--------+ | ||
+ | 1 row in set (0.00 sec) | ||
+ | to | ||
+ | +----------------+--------+ | ||
+ | | Variable_name | Value | | ||
+ | +----------------+--------+ | ||
+ | | storage_engine | '''InnoDB''' | | ||
+ | +----------------+--------+ | ||
+ | 1 row in set (0.00 sec) | ||
== Install PHP module for Apache == | == Install PHP module for Apache == | ||
<pre> | <pre> | ||
- | $ sudo apt-get install php5 libapache2-mod-php5 | + | $ sudo apt-get install php5 libapache2-mod-php5 |
+ | </pre> | ||
+ | |||
+ | |||
+ | ===Install GD Graphics Library (Optional)=== | ||
+ | <pre> | ||
+ | $ sudo apt-get install php5-gd | ||
</pre> | </pre> | ||
Line 48: | Line 130: | ||
== Install PHPMyAdmin== | == Install PHPMyAdmin== | ||
<pre> | <pre> | ||
- | $ apt-get install phpmyadmin | + | $ apt-get install phpmyadmin |
</pre> | </pre> | ||
+ | |||
+ | *To make it always use SSL, open the <code>phpmyadmin.conf</code> file in the <code>/etc/apache2/conf.d</code> directory and add <code>SSLRequireSSL</code>. | ||
+ | e.g.) | ||
+ | <Directory /usr/share/phpmyadmin> | ||
+ | Options Indexes FollowSymLinks | ||
+ | DirectoryIndex index.php | ||
+ | |||
+ | '''SSLRequireSSL''' | ||
+ | |||
+ | ...... | ||
+ | </Directory> |
Latest revision as of 06:04, 1 January 2013
APM in web application development normally stands for 'Apache Web Server, PHP and MySQL.'
This instruction is for Ubuntu Linux 8.04 (possibly other versions). It may work for other Linux distributions or may not. This document only has the essential information to install those software packages so for details please see other documents which have the details such as how to configure and use.
Contents |
Install Apache Web Server
$ sudo apt-get install apache2
Install MySQL Database
$ sudo apt-get install mysql-server
Configuration
-open /etc/mysql/my.cnf
file
= Change Charset
-add default-character-set=utf8
user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english default-character-set=utf8 skip-external-locking ... [mysql] #no-auto-rehash # faster start of mysql but no tab completion default-character-set=utf8
- For 5.5
[mysqld] # ... collation-server = utf8_unicode_ci init-connect='SET NAMES utf8' character-set-server = utf8
-After adding these two lines, the result of the following command
mysql> show variables like '%character%';
should be changed from
+--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | latin1 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec)
to
+--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec)
Change Default Database Engine to InnoDB
- add default-storage-engine
# * InnoDB # # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. # Read the manual for more InnoDB related options. There are many! # # * Security Features # # Read the manual, too, if you want chroot! # chroot = /var/lib/mysql/ # # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". # # ssl-ca=/etc/mysql/cacert.pem # ssl-cert=/etc/mysql/server-cert.pem # ssl-key=/etc/mysql/server-key.pem default-storage-engine=InnoDB
-After changing it, the result of the following command should be changed
mysql> show variables like '%storage_engine%';
from
+----------------+--------+ | Variable_name | Value | +----------------+--------+ | storage_engine | MyISAM | +----------------+--------+ 1 row in set (0.00 sec)
to
+----------------+--------+ | Variable_name | Value | +----------------+--------+ | storage_engine | InnoDB | +----------------+--------+ 1 row in set (0.00 sec)
Install PHP module for Apache
$ sudo apt-get install php5 libapache2-mod-php5
Install GD Graphics Library (Optional)
$ sudo apt-get install php5-gd
Install PHPMyAdmin
$ apt-get install phpmyadmin
- To make it always use SSL, open the
phpmyadmin.conf
file in the/etc/apache2/conf.d
directory and addSSLRequireSSL
.
e.g.)
<Directory /usr/share/phpmyadmin> Options Indexes FollowSymLinks DirectoryIndex index.php SSLRequireSSL ...... </Directory>