LAMP環境配置安裝註意安裝步驟及說明事項。 LAMP安裝各種問題解決 1. 訪問ftp報錯 解決: 關閉selinux vi /etc/selinux/config 內容修改為: selinux=disable 之後重啟reboot。 下圖分別為selinux關閉前 和 關閉後: 2. 依賴軟體查... ...
LAMP環境配置安裝註意安裝步驟及說明事項。
LAMP安裝各種問題解決
1. 訪問ftp報錯
解決:
關閉selinux
vi /etc/selinux/config
內容修改為: selinux=disable
之後重啟reboot。
下圖分別為selinux關閉前 和 關閉後:
2. 依賴軟體查詢
http://rpmfind.net
一.安裝gcc
gcc
cloog-ppl
ppl(libppl.so.7/libppl_c.so.2)
cpp
mpfr(libmpfr.so.1)
gcc-c++
libstdc++-devel
mpfr-2.4.1-6.el6.i686.rpm和ppl-0.10.2-11.el6.i686.rpm
快捷鍵rz sz:
rz、sz命令沒找到?
安裝lrzsz即可:
shell># yum -y install lrzsz
二.安裝zlib壓縮庫
shell>## cd /home/jinnan/tar
shell># tar –zxvf zlib-1.2.5.tar.gz
shell># cd zlib-1.2.5
shell># ./configure //這個配置編譯命令不要加目錄參數
shell># make && make install
三.安裝apache
shell># cd /home/jinnan/tar
shell># tar -jxvf httpd-2.2.19.tar.bz2
shell># cd httpd-2.2.19
shell>#./configure --prefix=/usr/local/http2 \
--enable-modules=all \
--enable-mods-shared=all \
--enable-so
shell># make && make install
啟動Apache
shell># /usr/local/http2/bin/apachectl start
#測試apache
瀏覽器打開: http://虛擬機IP
看到 "it works!",即為成功
配置虛擬主機
1)配置host文件
打開C:/windows/system32/drivers/etc/hosts 文件
增加功能變數名稱記錄
如:
192.168.9.38 www.ec1.com
192.168.9.38 www.ec2.com
2) 增加虛擬主機
vi /usr/local/http2/conf/httpd.conf
取消# Include conf/extra/httpd-vhosts.conf
這一行前面的#號
保存退出
vi /usr/local/http2/conf/extra/httpd-vhosts.conf
增加虛擬主機記錄
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/usr/local/http2/htdocs/ec1"
ServerName www.ec1.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/usr/local/http2/htdocs/ec2"
ServerName www.ec2.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/shop"
ServerName www.ec1.com
</VirtualHost>
註意:/var/www/shop 以上三個目錄var www shop 的其他用戶必須有x可執行許可權
3)
shell># cd /usr/local/http2/htdocs
shell># mkdir ec1 ec2
shell># echo this is ec1.com > ec1/index.html
shell># echo this is ec2.com > ec2/index.html
4)重啟apache
/usr/local/http2/bin/apachectl restart
5)瀏覽器打開www.ec1.com,和www.ec2.com
看到不同的網站內容,虛擬主機創建完畢!
安裝圖形庫,為編譯PHP做準備
libxml2-2.7.2.tar.gz
jpegsrc.v8b.tar.gz
libpng-1.4.3.tar.gz
freetype-2.4.1.tar.gz
gd-2.0.35.tar.gz
四.安裝libxml2
shell># cd /home/jinnan/tar
shell># tar zxvf libxml2-2.7.2.tar.gz
shell># cd libxml2-2.7.2
shell>#./configure --prefix=/usr/local/libxml2 \
五.安裝jpeg8
shell># tar -zxvf jpegsrc.v8b.tar.gz
shell>#./configure --prefix=/usr/local/jpeg \
--enable-shared --enable-static
--enable-shared 把jpeg需要的函數庫程式都編譯到該軟體裡邊
--enable-static 靜態方式函數處理,需要什麼函數,馬上include來
六.安裝libpng
shell># tar zxvf libpng-1.4.3.tar.gz
shell>#./configure #和zlib一樣不要帶參數,讓它預設安裝到相應目錄
七.安裝freetype(字體庫)
shell># tar zxvf freetype-2.4.1.tar.gz
shell>#./configure --prefix=/usr/local/freetype
八.安裝GD庫
shell># tar -zvxf gd-2.0.35.tar.gz
shell># mkdir -p /usr/local/gd
shell>#./configure --prefix=/usr/local/gd \
--with-jpeg=/usr/local/jpeg/ \
--with-freetype=/usr/local/freetype
九.安裝 php5
shell># tar -jxvf php-5.3.6.tar.bz2
shell>#./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/http2/bin/apxs \
--with-freetype-dir=/usr/local/freetype \
--with-zlib --with-libxml-dir=/usr/local/libxml2 \
--with-jpeg-dir=/usr/local/jpeg \
shell># cp php.ini-development /usr/local/php/lib/php.ini
vi /usr/local/http2/conf/httpd.conf
AddType application/x-httpd-php .php
vi /usr/local/apache2/htdocs/index.php
shell># /usr/local/http2/bin/apachectl restart
安裝MySQL
1.安裝cmake
shell># tar zxvf cmake-2.8.5.tar.gz
2.編譯安裝MySQL
shell># tar zxvf mysql-5.5.17.tar.gz
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DDEFAULT_COLLATION=utf8_general_ci
shell># rpm -ivh ncurses-devel-5.7-3.20090208.el6.i686.rpmshell># rm -f CMakeCache.txt //刪除該文件
shell># cmake 。。。 。。。 //重新cmake
shell># cp support-files/my-medium.cnf /etc/my.cnf
3.配置並初始化MySQL
shell># useradd mysql (該mysql用戶會存在於同名的組下)
shell># chmod +x /usr/local/mysql
(資料庫用戶信息不小心刪除光了,刪除data目錄,從此開始執行以下指令,直至結束)
shell># chown -R mysql.mysql /usr/local/mysql
shell># /usr/local/mysql/scripts/mysql_install_db \
--datadir=/usr/local/mysql/data &
把mysql安裝文件(除了data)的主人都改為root,避免資料庫恢復為出廠設置。
shell># chown -R root /usr/local/mysql
shell># chown -R mysql /usr/local/mysql/data
shell># /usr/local/mysql/bin/mysqld_safe --user=mysql &
shell># /usr/local/mysql/bin/mysql –u root
mysql> UPDATE user SET Password=password('123456') WHERE user='root';
配置開機自啟動服務項
shell># cp 安裝包解壓目錄/support-files/mysql.server /etc/init.d/mysqld
shell># chmod +x /etc/init.d/mysqld
shell># chkconfig --add mysqld
shell># chkconfig mysqld on //設置開機自啟動
/usr/local/http2/bin/apachectl start
/usr/local/mysql/bin/mysqld_safe --user=mysql &
[root@localhost httpd-2.2.19]# /usr/local/http2/bin/apachectl restart
httpd not running, trying to start
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
[root@localhost httpd-2.2.19]# netstat -lnp|grep 80
tcp 0 0 :::80 :::* LISTEN 28195/httpd
unix 2 [ ACC ] STREAM LISTENING 6580 1957/gpm /dev/gpmctl
unix 2 [ ACC ] STREAM LISTENING 5422 1800/pcscd /var/run/pcscd.comm
[root@localhost httpd-2.2.19]# ps 28195
28195 ? Ss 0:00 /usr/local/http2/bin/httpd -k restart
經過分析知道了80埠被系統的一個進程占用,這個進程是舊的apache服務
[root@localhost httpd-2.2.19]# kill -9 28195
[root@localhost httpd-2.2.19]#
十一.卸載操作系統自帶apache