tar zxvf apr-1.6.2.tar.gz
tar zxvf apr-util-1.6.0.tar.gz
tar jxf httpd-2.4.29.tar.bz2
mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util
[root@localhost opt]# cd httpd-2.4.29/
./configure \
--prefix=/usr/local/httpd \
--enable-so \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi
make && make install -j8
[root@localhost httpd-2.4.29]# cd /usr/local/httpd/bin
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vim /etc/init.d/httpd
# chkconfig: 35 85 21 //35级别自动运行 第85个启动 第21个关闭
# description: Apache is a World Wide Web server
chkconfig --add httpd //将httpd加入到SERVICE管理器
vim /usr/local/httpd/conf/httpd.conf
Listen 192.168.111.52:80 //52行
ServerName www.kgc.com //197行
ln -s /usr/local/httpd/conf/httpd.conf /etc/
ln -s /usr/local/httpd/bin/* /usr/local/bin/
httpd -t
service httpd start
ss -ntap | grep "80"
在浏览器上输入192.168.111.52 验证
修改网站内容
[root@localhost bin]# cd /usr/local/httpd/htdocs/
[root@localhost htdocs]# ls
index.html
[root@localhost htdocs]# vim index.html
三、安装MYSQL-----http://mirrors.sohu.com/mysql/—
[root@localhost htdocs]# cd /opt
yum install -y ncurses-devel autoconf cmake
tar xzvf mysql-5.6.26.tar.gz
cd mysql-5.6.26
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DSYSCONFIDIR=/etc \
-DMYSQL_DATADIR=/home/mysql/ \
-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock
make && make install -j8
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig --add /etc/init.d/mysqld
chkconfig mysqld --level 35 on
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
echo $PATH
cd /opt
tar xjvf php-5.6.11.tar.bz2
cd php-5.6.11
./configure \
--prefix=/usr/local/php5 \
--with-gd \
--with-zlib \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-config-file-path=/usr/local/php5 \
--enable-mbstring
make && make install -j8
[root@localhost php-5.6.11]# cd /usr/local/php5/
ln -s /usr/local/php5/bin/* /usr/local/bin/
vim /etc/httpd.conf //在合适位置新增
256行 DirectoryIndex index.html index.php
392行 AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
vim /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>
[root@localhost php5]# service httpd stop
[root@localhost php5]# service httpd start
在网页测试“http://192.168.80.182/index.php”
五、安装论坛
mysql> CREATE DATABASE bbs; //创建一个数据库//
mysql> GRANT all ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY 'abc123'; //把bbs数据库里面所有表的权限授予给bbsuser,并设置密码// 所有访问来源/渠道
mysql>flush privileges; //刷新数据库//
exit
[root@localhost php5]# cd /opt
unzip /opt/Discuz_X2.5_SC_UTF8.zip -d /opt/dis
cd /opt/dis
cp -r upload/ /usr/local/httpd/htdocs/bbs
cd /usr/local/httpd/htdocs/bbs