一、安裝HTTP(Apache)
1.安裝APR 和 APR-Util
所用代碼
cd apr ./configure --prefix=/usr/local/ap make && make install cd apr-util ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config make && make install cd pcre ./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-config make && make install cd httpd ./configure --prefix=/usr/local/httpd --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util make && make install
2.配置http開機自啓動
所用代碼
cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd vim /etc/rc.d/init.d/httpd //註冊到linux服務列表 /** 添加如下代碼 chkconfig: 35 61 61 description: Apache **/ chkconfig --add httpd //啓動 關閉 重啓 ./apachectl start ./apachectl stop ./apachectl restart
二、安裝MySQL 5.7.x
所用代碼
//創建用戶組 groupadd mysql //創建用戶並添加用戶到用戶組 useradd -r -g mysql mysql //修改mysql目錄所有者 chown -R mysql:mysql ./ //在mysql目錄下創建data空目錄 mkdir data //安裝mysql mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data //如果報錯用下面的代碼 mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize //安裝完成後編輯 /etc/my.cnf [mysqld] datadir=/usr/local/mysql/data basedir=/usr/local/mysql socket=/tmp/mysql.sock user=mysql port=3306 character-set-server=utf8 # 取消密碼驗證 skip-grant-tables # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # skip-grant-tables [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid //開啓服務 cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql //開機自啓 chkconfig mysql on //啓動服務 service mysql start //登錄數據庫 mysql/bin/mysql -u root -p //修改密碼 update user set authentication_string=password('你的密碼') where user='root'; //刷新權限 flush privileges; //退出將/etc/my.cnf中的skip-grant-tables刪除 //登錄再次設置密碼 ALTER USER 'root'@'localhost' IDENTIFIED BY '修改後的密碼'; //退出系統再次進入就可以正常使用數據庫了
三、安裝php
yum -y install libcurl-devel yum -y install libXpm-devel yum -y install libxml2-devel yum -y install php-mbstring
安裝libmcrypt
./configure make && make install
安裝libvpx
./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9 make && make install
安裝tiff
./configure --prefix=/usr/local/tiff --enable-shared make && make install
安裝libpng
./configure --prefix=/usr/local/libpng --enable-shared make && make install
安裝freetype
./configure --prefix=/usr/local/freetype --enable-shared make && make install
安裝jpeg
./configure --prefix=/usr/local/jpeg --enable-shared make && make install
安裝libgd
./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/ --with-tiff=/usr/local/tiff --with-webp=/usr/local/libwebp/ make && make install
安裝php
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-zlib-dir=/usr/local/zlib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype make && make install
可能會出現關於zip擴展的錯誤信息,如果出現則把其中關於zip的擴展去掉
參考博客:https://www.cnblogs.com/zoulongbin/p/6379272.html