在Linux中安装MYSQL并创建一个论坛
[root@localhost ~]# cd /opt/
[root@localhost opt]# rm -rf *
#移动到/opt目录下清空所有文件
将这6个压缩包导入/opt
链接:https://pan.baidu.com/s/19ZSK1zsfy50gBWu_2q6c6A
提取码:1103
#请保证计算机有至少60G的容量,因为安装会占用大量的indo号,mysql可能安装不上
编译make
#将这些压缩包解压到当前文件夹
[root@localhost opt]# tar zxvf apr-1.6.2.tar.gz
[root@localhost opt]# ls
apr-1.6.2 apr-util-1.6.0.tar.gz httpd-2.4.29.tar.bz2 php-5.6.11.tar.bz2
apr-1.6.2.tar.gz Discuz_X2.5_SC_UTF8.zip mysql-5.6.26.tar.gz
[root@localhost opt]# tar zxvf apr-util-1.6.0.tar.gz
[root@localhost opt]# ls
apr-1.6.2 apr-util-1.6.0 Discuz_X2.5_SC_UTF8.zip mysql-5.6.26.tar.gz
apr-1.6.2.tar.gz apr-util-1.6.0.tar.gz httpd-2.4.29.tar.bz2 php-5.6.11.tar.bz2
[root@localhost opt]# tar jxf httpd-2.4.29.tar.bz2
[root@localhost opt]# ls
apr-1.6.2 apr-util-1.6.0.tar.gz httpd-2.4.29.tar.bz2
apr-1.6.2.tar.gz Discuz_X2.5_SC_UTF8.zip mysql-5.6.26.tar.gz
apr-util-1.6.0 httpd-2.4.29 php-5.6.11.tar.bz2
#将前两个压缩出来的文件移动到 httpd-2.4.29/srclib 目录下并改名
[root@localhost opt]# ls httpd-2.4.29/srclib/
Makefile.in
[root@localhost opt]# mv apr-1.6.2 httpd-2.4.29/srclib/apr
[root@localhost opt]# mv apr-util-1.6.0 httpd-2.4.29/srclib//apr-util
[root@localhost opt]# ls httpd-2.4.29/srclib/
apr apr-util Makefile.in
#移动到这个目录下
[root@localhost opt]# cd httpd-2.4.29/
[root@localhost httpd-2.4.29]# ls
ABOUT_APACHE buildconf httpd.dsp libhttpd.mak README.cmake
acinclude.m4 CHANGES httpd.mak LICENSE README.platforms
Apache-apr2.dsw CMakeLists.txt httpd.spec Makefile.in ROADMAP
Apache.dsw config.layout include Makefile.win server
apache_probes.d configure INSTALL modules srclib
ap.d configure.in InstallBin.dsp NOTICE support
build docs LAYOUT NWGNUmakefile test
BuildAll.dsp emacs-style libhttpd.dep os VERSIONING
BuildBin.dsp httpd.dep libhttpd.dsp README
#安装一些工具
[root@localhost httpd-2.4.29]# yum -y install \
> gcc \
> gcc-c++ \
> make \
> pcre-devel \
> expat-devel \
> perl
[root@localhost httpd-2.4.29]# ./configure \
> --prefix=/usr/local/httpd \
> --enable-so \
> --enable-rewrite \
> --enable-charset-lite \
> --enable-cgi
#编译make,注:-j8是指我用8颗内核运行这个安装程序,不能比自己电脑的内核高
[root@localhost httpd-2.4.29]# make && make install -j8
编译阿帕奇
#移动到这条目录下的bin中
[root@localhost httpd-2.4.29]# cd /usr/local/httpd/
[root@localhost httpd]# ls
bin cgi-bin error icons lib man modules
build conf htdocs include logs manual
[root@localhost httpd]# cd bin/
[root@localhost bin]# ls
ab apu-1-config dbmmanage fcgistarter htdigest httxt2dbm
apachectl apxs envvars htcacheclean htpasswd logresolve
apr-1-config checkgid envvars-std htdbm httpd rotatelogs
#将bin中的apachectl复制到指定目录下
[root@localhost bin]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
#编辑这个脚本,将这两段插入
[root@localhost bin]# vim /etc/init.d/httpd
# chkconfig: 35 85 21 //35级别自动运行 第85个启动 第21个关闭
# description: Apache is a World Wide Web server
这是注释
#将httpd加入到SERVICE管理器
[root@localhost bin]# chkconfig --add httpd
[root@localhost bin]# vim /usr/local/httpd/conf/httpd.conf
#编辑第51行,设置自己的IP地址,为了监听自己
Listen 192.168.254.10:80
#编辑第197行,写一个本机的域名地址,名字自起
ServerName www.rui.com:80
#如果不知道自己有没有做好,可以使用以下两条命令检查一下语法
[root@localhost bin]# httpd -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK
[root@localhost bin]# apachectl -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK
#如果出现以上现象按如下操作
[root@localhost bin]# vim /etc/httpd/conf/httpd.conf
找到这条
#ServerName www.example.com:80
改成这条
ServerName localhost:80
#再试一次,如果有问题则重启httpd:systemctl restart httpd
[root@localhost bin]# apachectl -t
Syntax OK
[root@localhost bin]# httpd -t
Syntax OK
#做两条软链接,方便直接使用
[root@localhost bin]# ln -s /usr/local/httpd/conf/httpd.conf /etc/
[root@localhost bin]# ln -s /usr/local/httpd/bin/* /usr/local/bin/
#注意关闭防火墙
[root@localhost bin]# systemctl stop firewalld.service
[root@localhost bin]# setenforce 0
[root@localhost bin]# service httpd start
#使用grep过滤一下“80”
[root@localhost bin]# ss -ntap |grep "80"
LISTEN 0 128 192.168.254.10:80 *:* users:(("httpd",pid=88744,fd=3),