Lamp Environment Construction
MySQL and Apache installations have no sequencing, but PHP must be the last to be loaded
1. Install MySQL
32-bit http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
64-bit http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-x86_64-icc-glibc23.tar.gz
Place the download file in the directory
[Email protected] ~]# cd/usr/local/src/[[email protected] src]# lsmysql-5.1.40-linux-i686-icc-glibc23.tar.gz
You can look at the file size
[Email protected] src]# du-sh mysql-5.1.40-linux-i686-icc-glibc23.tar.gz 118M Mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
Extract
[Email protected] src]# tar zxvf mysql-5.1.40-linux-i686-icc-glibc23.tar.gz [[email protected] src]# Lsmysql-5.1.40-linux-i686-icc-glibc23 mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
Move files to the/usr/local/mysql directory
[Email protected] src]# MV Mysql-5.1.40-linux-i686-icc-glibc23/usr/local/mysql
Add a user named MySQL, but don't log in now
[[email protected] src]# useradd-s/sbin/nologin MySQL
Create Data Save Directory
[Email protected] src]# mkdir-p/data/mysql
Assigning permissions to the directory
[Email protected] mysql]# chown-r mysql:mysql/data/mysql
I still do not understand what the meaning of this sentence, the first to write, later understand the change
[Email protected] mysql]#/scripts/mysql_install_db--user=mysql--datadir=/data/mysql
Check that the installation is successful (the command is appropriate for all, 0 indicates successful installation)
[Email protected] mysql]# echo $?0
View some information
[[email protected] mysql]# ls /data/mysql/mysql test[[email protected] mysql]# lsbin docs install-binary mysql-test sharecopying EXCEPTIONS-CLIENT lib README sql-benchdata include man scripts support-files[[email protected] mysql]# ls support-files/binary-configure my-huge.cnf mysqld_multi.serverconfig.huge.ini my-innodb-heavy-4g.cnf mysql-log-rotateconfig.medium.ini my-large.cnf mysql.serverconfig.small.ini my-medium.cnf ndb-config-2-node.inimagic my-small.cnf
I don't know how to write that.
[[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld[[email protected] mysql]# chkconfig--list The MYSQLDMYSQLD service supports Chkconfig, but it is not referenced at any level (runs "Chkconfig--add mysqld") [[email protected] mysql]# chmod 755/etc/init.d/ mysqld [[email protected] mysql]# chkconfig--add mysqld[[email protected] mysql]# chkconfig mysqld on[[email protected] m ysql]# chkconfig--list mysqld mysqld 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off
Edit the file
[Email protected] mysql]# Vim/etc/init.d/mysqld
The change is that the 2 configurations
Basedir=/usr/local/mysqldatadir=/data/mysql
Copy files and agree to overwrite
[email protected] mysql]# CP support-files/my-huge.cnf/etc/my.cnf CP: Do you want to overwrite "/etc/my.cnf"? Y
Start the service
[[Email protected] mysql]# service mysqld startstarting MySQL. success!
Or you can start it like this.
[[email protected] mysql]#/etc/init.d/mysqld restartshutting down MySQL. success! Starting MySQL. success!
View service Processes
[[email protected] mysql]# ps aux | grep mysqlroot 1684 0.0 0.1 6676 1340 pts/1 s 13:40 0:00 /bin/sh /usr/local/mysql/bin/mysqld _safe --datadir=/data/mysql --pid-file=/data/mysql/centos6.6.pidmysql 1790 0.2 5.8 539328 60120 pts/1 sl 13:40 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql -- datadir=/data/mysql --user=mysql --log-error=/data/mysql/centos6.6.err --pid-file=/data/mysql/ centos6.6.pid --socket=/tmp/mysql.sock --port=3306root 1803 0.0 0.0 5976 744 pts/1 S+ 13:41 &Nbsp; 0:00 grep mysql
View 3306 This port
[Email protected] mysql]# NETSTAT-LNP | grep 3306tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1790/mysqld
View some of the files inside,. Err is a log file
[Email protected] mysql]# ls/data/mysql/centos6.6.err ib_logfile0 mysql-bin.000001 testcentos6.6.pid ib_logfile1 my Sql-bin.000002ibdata1 MySQL Mysql-bin.index
2. Installing Apache
wget http://syslab.comsenz.com/downloads/linux/httpd-2.2.16.tar.gz
Place the download file in the directory
[Email protected] ~]# cd/usr/local/src/[[email protected] src]# lshttpd-2.2.16.tar.gz mysql-5.1.40-linux-i686-icc- Glibc23.tar.gz
You can look at the file size
[Email protected] src]# du-sh httpd-2.2.16.tar.gz 6.1M httpd-2.2.16.tar.gz
Extract
[Email protected] src]# tar zxvf httpd-2.2.16.tar.gz [[email protected] src]# lshttpd-2.2.16 httpd-2.2.16.tar.gz my Sql-5.1.40-linux-i686-icc-glibc23.tar.gz
Go to Catalog
[Email protected] src]# CD Httpd-2.2.16[[email protected] httpd-2.2.16]#./configure--prefix=/usr/local/apache2-- Enable-mods-shared=most--enable-so
Compile
[[email protected] httpd-2.2.16]# make && make install
Check that the installation is successful (the command is appropriate for all, 0 indicates successful installation)
[Email protected] httpd-2.2.16]# echo $?0
View information
[Email protected] httpd-2.2.16]# ls/usr/local/apache2/bin cgi-bin error icons lib man modulesbuild conf Htdocs include logs manual
Start the service
[Email protected] httpd-2.2.16]#/usr/local/apache2/bin/apachectl Starthttpd:apr_sockaddr_info_get () failed for Centos6.6httpd:could not reliably determine the server ' s fully qualified domain name, using 127.0.0.1 for ServerName
View process, all OK
[[email protected] httpd-2.2.16]# ps aux | grep httpdroot 25902 0.1 0.2 5408 2316 ? ss 15:55 0:00 /usr/local/apache2/bin/ httpd -k startdaemon 25903 0.0 0.1 5540 1588 ? S 15:55 0:00 /usr/local/apache2/bin/httpd -k startdaemon 25904 0.0 0.1 5540 1588 ? S 15:55 0:00 /usr/local/apache2/bin/httpd -k startdaemon 25905 0.0 0.1 5540 1588 ? &nBsp; s 15:55 0:00 /usr/local/apache2/bin/httpd -k startdaemon 25906 0.0 0.1 5540 1588 ? s 15:55 0:00 /usr/local/apache2/bin/httpd -k startdaemon 25907 0.0 0.1 5540 1588 ? s 15:55 0:00 /usr/local/apache2/bin/httpd -k startroot 25909 1.0 0.0 5980 752 pts/1 s+ 15:56 0:00 grep httpd
3. Install PHP
Linux 2nd day