大佬教程收集整理的这篇文章主要介绍了CentOS7.3搭建Apache+PHP7+web SVN+MariaDB Web服务器(2017-08-20),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
下面开始进入教程吧。
[root@instance-l79ltvo6 ~]# yum -y @R_618_9531@e ... Complete!
直到控制台输出Complete!说明升级完成,最好还是重启一下吧
[root@instance-l79ltvo6 ~]# reboot
先安装一些基本依赖
[root@instance-l79ltvo6 ~]# yum install -y gcc gcc-c++ openssl-devel zlib-devel //在root目录下创建一个soft文件夹,我们本次教程的软件将都放在该目录下 [root@instance-l79ltvo6 ~]# mkdir soft [root@instance-l79ltvo6 ~]# cd soft
[root@instance-l79ltvo6 ~]# wget https://mirror.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.2.tar.gz [root@instance-l79ltvo6 ~]# tar zxf apr-1.6.2.tar.gz [root@instance-l79ltvo6 ~]# cd apr-1.6.2/ [root@instance-l79ltvo6 ~]# ./configure --prefix=/usr/local/apr [root@instance-l79ltvo6 ~]# make && make install [root@instance-l79ltvo6 ~]# cd .. //返回上级目录
[root@instance-l79ltvo6 ~]# wget https://sourceforge.net/projects/expat/files/expat/2.2.3/expat-2.2.3.tar.bz2 [root@instance-l79ltvo6 ~]# tar jxf expat-2.2.3.tar.bz2 [root@instance-l79ltvo6 ~]# cd expat-2.2.3/ [root@instance-l79ltvo6 ~]# ./configure --prefix=/usr/local/expat [root@instance-l79ltvo6 ~]# make && make install [root@instance-l79ltvo6 ~]# cd .. //返回上级目录
[root@instance-l79ltvo6 ~]# wget https://mirror.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.0.tar.gz [root@instance-l79ltvo6 ~]# tar zxf apr-util-1.6.0.tar.gz [root@instance-l79ltvo6 ~]# cd apr-util-1.6.0/ [root@instance-l79ltvo6 ~]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr --with-expat=/usr/local/expat [root@instance-l79ltvo6 ~]# make && make install [root@instance-l79ltvo6 ~]# cd .. //返回上级目录
[root@instance-l79ltvo6 ~]# wget http://sourceforge.mirrorservice.org/p/pc/pcre/pcre/8.41/pcre-8.41.tar.gz [root@instance-l79ltvo6 ~]# tar zxf pcre-8.41.tar.gz [root@instance-l79ltvo6 ~]# cd pcre-8.41/ [root@instance-l79ltvo6 ~]# ./configure --prefix=/usr/local/pcre [root@instance-l79ltvo6 ~]# make && make install [root@instance-l79ltvo6 ~]# cd .. //返回上级目录
[root@instance-l79ltvo6 ~]# wget http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.27.tar.gz [root@instance-l79ltvo6 ~]# tar zxf httpd-2.4.27.tar.gz [root@instance-l79ltvo6 ~]# cd httpd-2.4.27/ [root@instance-l79ltvo6 ~]# ./configure \ --prefix=/usr/local/apache \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --with-pcre=/usr/local/pcre \ --with-ssl \ --with-zlib \ --with-mpm=worker \ --enable-rewrite \ --enable-so \ --enable-ssl \ --enable-cache \ --enable-disk-cache \ --enable-file-cache \ --enable-mem-cache \ --enable-headers \ --enable-expires \ --enable-deflate \ --enable-dav \ --enable-dav-fs \ --enable-cgi \ --enable-proxy \ --enable-proxy-fcgi //这里请根据自身实际情况开启相关模块 [root@instance-l79ltvo6 ~]# make && make install [root@instance-l79ltvo6 ~]# cd .. //返回上级目录
#LoadModule ssl_module modules/mod_ssl.so //去掉#开启 SSL #LoadModule rewrite_module modules/mod_rewrite.so //去掉#开启 rewrite #ServerName www.example.com:80 //去掉#并把 www.example.com:80 修改为你的IP:80或者域名 #Include conf/extra/httpd-vhosts.conf //去掉#,开启虚拟主机配置 //如果你需要安装svn服务,你需要开启 #LoadModule dav_module modules/mod_dav.so//去掉#
<Directory /> AllowOverride none require all denied </Directory> //修改为 <Directory /> Options Indexes FollowSymLinks //如不需要显示目录,把 Indexes 去掉 AllowOverride ALL //开启rewrite require all granted </Directory>
<VirtualHost *:80> DocumentRoot "/usr/local/apache/htdocs" ServerName your IP //你的IP地址 ErrorLog "logs/你的IP-error_log" CustomLog "logs/你的IP-access_log" common </VirtualHost>
[root@instance-l79ltvo6 ~]# cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/ [root@instance-l79ltvo6 ~]# mv /etc/rc.d/init.d/apachectl /etc/rc.d/init.d/httpd [root@instance-l79ltvo6 ~]# cd /etc/rc.d/init.d/
# Comments to support chkconfig on RedHat Linux # chkconfig: 2345 90 90 # description:http server
[root@instance-l79ltvo6 ~]# chkconfig --add httpd [root@instance-l79ltvo6 ~]# chkconfig httpd on
[root@instance-l79ltvo6 ~]# vim /etc/profile.d/httpd.sh //写入 export PATH=$PATH:/usr/local/apache/bin //保存后赋予执行权限 [root@instance-l79ltvo6 ~]# chmod 0777 /etc/profile.d/httpd.sh [root@instance-l79ltvo6 ~]# source /etc/profile.d/httpd.sh
[root@instance-l79ltvo6 ~]# /usr/local/apache/bin/apachectl -t Syntax OK //说明没问题,可以直接启动
[root@instance-l79ltvo6 ~]# systemctl start httpd.service
It works!
[root@instance-l79ltvo6 ~]# cd /root/soft [root@instance-l79ltvo6 ~]# wget http://sourceforge.mirrorservice.org/s/sc/scons/scons/2.5.1/scons-2.5.1.tar.gz [root@instance-l79ltvo6 ~]# tar zxf scons-2.5.1.tar.gz [root@instance-l79ltvo6 ~]# cd scons-2.5.1/ [root@instance-l79ltvo6 ~]# python setup.py install --prefix=/usr/local/scons [root@instance-l79ltvo6 ~]# cd .. //返回上级目录
[root@instance-l79ltvo6 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/serf/serf-1.3.9.tar.bz2 [root@instance-l79ltvo6 ~]# tar xf serf-1.3.9.tar.bz2 [root@instance-l79ltvo6 ~]# cd serf-1.3.9/ [root@instance-l79ltvo6 ~]# /usr/local/scons/bin/scons prefix=/usr/local/serf APR=/usr/local/apr APU=/usr/local/apr-util [root@instance-l79ltvo6 ~]# /usr/local/scons/bin/scons install [root@instance-l79ltvo6 ~]# cd .. //返回上级目录
[root@instance-l79ltvo6 ~]# wget http://www.sqlite.org/2017/sqlite-amalgamation-3190300.zip [root@instance-l79ltvo6 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/subversion/subversion-1.9.7.tar.gz [root@instance-l79ltvo6 ~]# tar zxf subversion-1.9.7.tar.gz [root@instance-l79ltvo6 ~]# unzip sqlite-amalgamation-3190300.zip [root@instance-l79ltvo6 ~]# mv /root/soft/sqlite-amalgamation-3190300 /root/soft/subversion-1.9.7/sqlite-amalgamation [root@instance-l79ltvo6 ~]# cd subversion-1.9.7/ [root@instance-l79ltvo6 ~]# ./configure \ --prefix=/usr/local/svn \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --with-serf=/usr/local \ --enable-mod-activation \ --with-apache-libexecdir=/usr/local/apache/modules \ --with-apxs=/usr/local/apache/bin/apxs \ --without-berkeley-db [root@instance-l79ltvo6 ~]# make && make install
[root@instance-l79ltvo6 ~]# useradd svn -s /sbin/nologin
[root@instance-l79ltvo6 ~]# vim /etc/profile.d/svn.sh //添加 export PATH=$PATH:/usr/local/svn/bin 保存后赋予执行权限 [root@instance-l79ltvo6 ~]# chmod 0777 /etc/profile.d/svn.sh [root@instance-l79ltvo6 ~]# source /etc/profile.d/svn.sh
[root@instance-l79ltvo6 ~]# vim /etc/ld.so.conf.d/serf-1.3.9.conf //添加 /usr/local/lib 保存后刷新 [root@instance-l79ltvo6 ~]# /sbin/ldconfig -v
[root@instance-l79ltvo6 ~]# mkdir -p /data/svn [root@instance-l79ltvo6 ~]# cd /data/svn [root@instance-l79ltvo6 ~]# svnadmin create test
conf db format hooks locks README.txt
[root@instance-l79ltvo6 ~]# cp /data/svn/test/conf/authz /data/svn/authz [root@instance-l79ltvo6 ~]# cp /data/svn/test/conf/passwd /data/svn/passwd [root@instance-l79ltvo6 ~]# cp /data/svn/test/conf/svnserve.conf /data/svn/svnserve.conf //然后设置一个用户密码,这里以创建root用户为例,这里的演示是将密码加密而非明文存储 [root@instance-l79ltvo6 ~]# htpasswd -c /data/svn/passwd root New password: //输入密码 Re-type new password: //再次输入密码
[root@instance-l79ltvo6 ~]# vim /data/svn/svnserve.conf //删除所有内容,增加下面的代码 [general] anon-access = read auth-access = write password-db = passwd authz-db = authz [sasl] //保存 [root@instance-l79ltvo6 ~]# vim /data/svn/authz //删除所有内容,增加下面的代码 [aliases] # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil,Ltd./OU=Research Institute/CN=Joe Average [groups] administrators = root [/] @administrators=rw [test:/] * = r //保存
[root@instance-l79ltvo6 ~]# svnserve --config-file /data/svn/svnserve.conf -d -r /data/svn
[root@instance-l79ltvo6 ~]# chown -R svn:svn /data/svn
//找到 User daemon Group daemon //修改为 User svn Group svn
<VirtualHost *:80> ServerName 你的IP ErrorLog "logs/你的IP-error_log" CustomLog "logs/你的IP-access_log" common <LOCATIOn /svn> DAV svn #support more repositories SVNParentPath /data/svn #list all repositories #SVNListParentPath on AuthType Basic AuthName "Please input Username and password" AuthUserFile /data/svn/passwd AuthzSVNAccessFile /data/svn/authz require valid-user </LOCATIOn> </VirtualHost>
[root@instance-l79ltvo6 ~]# systemctl stop httpd.service
[root@instance-l79ltvo6 ~]# /usr/local/apache/bin/apachectl -t Syntax OK //说明没问题,可以直接启动
[root@instance-l79ltvo6 ~]# systemctl start httpd.service
test - Revision 0: /
[root@instance-l79ltvo6 ~]# yum -y install gcc gcc-c++ autoconf automake libtool re2c flex bison PHP-mcrypt libmcrypt libmcrypt-devel openssl-devel libxml2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel zlib-devel mcrypt bzip2-devel libicu-devel systemd-devel mhash POSTGResql-devel libxslt libxslt-devel
[root@instance-l79ltvo6 ~]# cd /root/soft [root@instance-l79ltvo6 ~]# wget http://cn.PHP.net/diStributions/PHP-7.1.8.tar.gz [root@instance-l79ltvo6 ~]# tar zxf PHP-7.1.8.tar.gz [root@instance-l79ltvo6 ~]# cd PHP-7.1.8/ [root@instance-l79ltvo6 ~]# ./configure \ --prefix=/usr/local/PHP \ --with-apxs2=/usr/local/apache/bin/apxs \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-MysqLi \ --with-openssl \ --with-pcre-regex \ --with-pdo-MysqL \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --with-mhash \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbString \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip \ --enable-MysqLnd [root@instance-l79ltvo6 ~]# make && make install ... //漫长的等待
[PEAR] Archive_Tar - installed: 1.4.3 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.5 Wrote PEAR system config file at: /usr/local/PHP/etc/pear.conf You may want to add: /usr/local/PHP/lib/PHP to your PHP.ini include_path /root/soft/PHP-7.1.8/build/shtool install -c ext/phar/phar.phar /usr/local/PHP/bin ln -s -f phar.phar /usr/local/PHP/bin/phar Installing PDO headers: /usr/local/PHP/include/PHP/ext/pdo/
[root@instance-l79ltvo6 ~]# cp PHP.ini-development /usr/local/PHP/lib/PHP.ini
LoadModule PHP7_module modules/libPHP7.so //默认是开启PHP7.so //找到 <IfModule mime_module>,在</IfModule>前面增加 AddType application/x-httpd-PHP .PHP .PHP3 .phtml .inc AddType application/x-httpd-PHP-source .PHPs //找到 DirectoryIndex index.html,增加index.PHP DirectoryIndex index.html index.shtml index.cgi index.PHP index.phtml index.PHP3
[root@instance-l79ltvo6 ~]# /usr/local/apache/bin/apachectl -t Syntax OK //说明没问题,可以直接启动
[root@instance-l79ltvo6 ~]# vim /etc/profile.d/PHP.sh //加入 export PATH=$PATH:/usr/local/PHP/bin //保存后赋予执行权限 [root@instance-l79ltvo6 ~]# chmod 0777 /etc/profile.d/PHP.sh [root@instance-l79ltvo6 ~]# source /etc/profile.d/PHP.sh
[root@instance-l79ltvo6 ~]# systemctl stop httpd.service [root@instance-l79ltvo6 ~]# systemctl start httpd.service
[root@instance-l79ltvo6 ~]# vim /usr/local/apache/htdocs/PHPinfo.PHP //加入 <?PHP PHPinfo(); ?>
以上是大佬教程为你收集整理的CentOS7.3搭建Apache+PHP7+web SVN+MariaDB Web服务器(2017-08-20)全部内容,希望文章能够帮你解决CentOS7.3搭建Apache+PHP7+web SVN+MariaDB Web服务器(2017-08-20)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。