CentOS7搭建LAMP服务器相关步骤(精)



1、安装CentOS 7 (不详)
[X]ssh:
#systemctl start sshd.service
#systemctl enable sshd.service
 
2、配置静态IP地址
#ifconfig 查看网络相关,注意所开启的网卡的相关参数
#cd /etc/sysconfig/network-scripts/ 进入网卡配置目录
#ls 查看目录列表
#vi ifcfg-enp0s3 编辑网络参数,主要参数如下:
[X]BOOTPROTO=none  //dhcp改成none,static
[ ]NAME=enp0s3
[X]ONBOOT=yes //开启开机自启动
[X]HWADDR=08:00:27:A5:8E:B9 //MAC地址,非常重要!
[ ]IPADDR=192.168.16.64 //静态ip地址
[X]PREFIXO=24 //子网掩码
[X]GATEWAY=192.168.16.1 //网关地址
[X]DNS1=8.8.8.8 //DNS服务器
[ ]DNS2=8.8.4.4 //备用DNS服务器


3、配置防火墙
      3.1开启80端口
          In order to open port 80 you need to run these commands:
#firewall-cmd --zone=public --add-port=http/tcp
#firewall-cmd --zone=public --add-port=http/tcp --permanent
          Full documentation for this is available here:
          https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html

4、安装LAMP服务器
[X]#yum install httpd
[X]#yum install mariadb mariadb-server
[X]#yum install php
[X]#yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
安装好后,执行命令:
#systemctl start httpd.service //开启apache服务器
#systemctl enable httpd.service //开机自启动apache
#systemctl start mariadb.service //开启mysql服务
#systemctl enable mariadb.service //开机自启动mysql
One-line command method(CentOS 7):
     sudo sh -c "yum install httpd httpd-devel mariadb mariadb-server mariadb-devel php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml -y; systemctl start mariadb.service && mysql_secure_installation && systemctl restart mariadb.service && systemctl start httpd.service && systemctl enable httpd.service && systemctl enable mariadb.service &&firewall-cmd --zone=public --add-port=http/tcp && firewall-cmd --zone=public --add-port=http/tcp --permanent"

5、安装SVN服务器(不详)
     [X]#yum install subversion
     5.1创建SVN仓库(不详)
         
[X]#mkdir -p /opt/svn/ //创建SVN根目录
[X]#svnadmin create /opt/svn/repo //创建repo测试库
[X]进入/opt/svn/repo/conf目录,配置passwd、authz、svnserve.conf
     5.2添加3690端口到防火墙:       
         
[X]#firewall-cmd --zone=public --add-port=3690/tcp
[X]#firewall-cmd --zone=public --add-port=3690/tcp --permanent
[X]svnserve -d -r /opt/svn/
      5.3配置Apache访问SVN(不详)
          [X]#yum install mod_dav_svn 
          [X]修改httpd.conf:
             

    
           
Dav svn
SVNParentPath "D:/SVN_REPOS"
SVNListParentPath on
AuthType Basic
AuthName "SVN Repository"
AuthUserFile "D:/SVN_REPOS/Test/conf/users“  //此文件由htpasswd命令生成
AuthzSVNAccessFile "D:/SVN_REPOS/Test/conf/authz"
Require valid-user

          [X]Apache同步更新SVN        
             
#mkdir /var/www/html/svn-preview/
#svn co http://my-svn-host/my-svn-path /var/www/html/svn-preview --username=my-svn-username
#cd /my-svn-path/repo/hooks
#cp post-commit.tmpl post-commit
#chmod +x post-commit
#vi post-commit
#svn up /var/www/html/svn-preview/ --username=my-svn-username --password=my-svn-username

ps:以上由本人亲自搭建LAMP环境后整理下的内容,整个过程会出现些小问题。此为精华,如需详细版本,敬请留意下次发表的文章。若安装过程中,遇到问题,请留下评论。欢迎大家一起学习,一起进步!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值