LAMP環境搭建

====CentOS5.5+Apache2.2.24+MySQL5.1.45+Php5.3.20 ====系統約定 01 源碼包存放路徑:/usr/local/src 02 apache安裝目錄:/usr/local/apache 03 mysql安裝目錄:/usr/local/mysql 04 php安裝目錄:/usr/local/php5 05 軟件包列表----httpd-2.2.24.tar.gz      mysql-5.1.45.tar.gz      php-5.3.20.tar.gz ====安裝編譯環境所需開發工具,開發包及基礎庫文件等 06 yum -y groupinstall "Development Tools" "Development Libraries" "X Software Development" ====編譯安裝apache 07 mkdir -p /usr/local/apache 08 cd /usr/local/src 09 tar xf httpd-2.2.24.tar.gz 10 cd httpd-2.2.24 11 ./configure --help 12 ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-ssl --enable-so  --with-zlib --enable-rewrite --enable-mods-shared=most --enable-proxy --enable-proxy-connect --enable-proxy-http 13 make && make install 14 vim /etc/profile添加PATH=$PATH:/usr/local/apache/bin 15 . !$ 16 ln -sv /usr/local/apache/include /usr/include/apache 17 vim /etc/ld.so.conf.d/apache.conf添加/usr/local/apache/lib 18 ldconfig -v ====編譯安裝mysql 19 groupadd mysql 20 useradd -g mysql -s /bin/false -M mysql 21 mkdir -p /usr/local/mysql 22 chown -R mysql:mysql /usr/local/mysql 23 cd /usr/local/src 24 tar xf mysql-5.1.45.tar.gz 25 cd mysql-5.1.45 26 ./configure --help 27 ./configure --prefix=/usr/local/mysql --sysconfdir=/etc --with-mysqld-user=mysql --without-debug --with-mysqld-ldflags=--all-static --with-client-ldflags=--all-static --with-plugins=innobase 28 make && make install 29 vim /etc/profile添加/usr/local/mysql/bin 30 . !$ 31 ln -sv /usr/local/mysql/inclued /usr/include/mysql 32 vim /etc/ld.so.conf.d/mysql.conf添加/usr/local/mysql/lib 33 ldconfig -v 33 mkdir -p /data/mydata 34 ./scripts/mysql_install_db --help 35 ./scripts/mysql_install_db --user=mysql --datadir=/data/mydata 36 cp support-files/my-large.cnf /etc/my.cnf 37 vim /etc/my.cnf添加datadir = /data/mydata 38 cp support-files/mysql.server /etc/init.d/mysqld 39 chmod +x !$ 40 chkconfig --add mysqld 41 chkconfig mysqld on 42 service mysqld start ====編譯安裝php 43 tar xf php-5.3.20.tar.gz 44 cd php-5.3.20 45 ./configure --help 46 ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring=all --with-jpeg --with-gd --with-curl 47 make && make install 48 vim /etc/profile添加/usr/local/php5/bin 48 . !$ 49 cp php.ini-production /usr/local/php5/lib/php.ini 50 vim /etc/httpd/httpd.conf添加AddType application/x-httpd-php .php與index.php ====測試php cd /usr/local/apache/htdocs rm -rf index.html echo -e "" > index.php 保存退出重啓httpd服務 service httpd restart ====測試php與mysql的連接 vim index.php插入一下內容 ====設置MySQL數據庫 mysqladmin -u root password 'Mysql_p@sswd_194' mysql -uroot -pMysql_p@sswd_194 select host,user,password from mysql.user; delete from mysql.user where password=''; flush privileges; grant all privileges on *.* to root@'%' identified by 'Mysql_p@sswd_194' with grant option;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章