第一步首先搭建LAMP环境:
1.安装httpd (Apache)
查看是否httpd是否已安装
rpm -qa | grep httpd
安装httpd
yum install httpd
启动httpd服务
systemctl start httpd
查看状态——是否已启动
systemctl status httpd
设置开机自启动
systemctl enable httpd
关闭防火墙
systemctl stop firewalld.service
禁止firewall开机自启动
systemctl disable firewalld.service
2.MariaDB
yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
mysql -uroot -p 进入数据库
重置数据库 root 账号密码( 默认root密码为空 ),命令行执行如下命令 , 注意执行命令前必须开启 mariadb服务:
mysql_secure_installation
Enter current password for root (enter for none): # 输入当前root账号密码,刚安装默认为空,直接回车即可
Set root password? [Y/n] # 是否输入root密码,输入y 回车
New password: # 输入密码
Re-enter new password: # 重复输入
Remove anonymous users? [Y/n] # 删除其他用户 y
Disallow root login remotely? [Y/n] # 允许root账号远程登录 y
Remove test database and access to it? [Y/n] # 删除测试表 y
Reload privilege tables now? [Y/n] # 重新加载配置表 y
3.PHP
PHP7.1 版本需要配置 yum 源 :
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装php及相关插件
yum -y install php php-pdo php-mbstring php-ldap php-gd php-json php-fpm php-mysqlnd(完美解决zentao中的依赖问题)
创建 phpinfo 文件, 测试 PHP 与 Apache 服务的整合:
echo '' > /var/www/html/index.php
访问前 , 重启 Apache 服务,浏览器访问http://服务器ip/index.php
启动PHP
service php-fpm start
4.zentao
先从官网下载源码包
http://dl.cnezsoft.com/zentao/12.3/ZenTaoPMS.12.3.stable.zip
解压禅道源码包到web启动目录
unzip ZenTaoPMS.*.zip -d /var/www/html
修改 Apache 访问路径: vim /etc/httpd/conf/httpd.conf
重启httpd服务
systemctl restart httpd
浏览器输入localhost即可开始安装
脚本如下(需要手动修改配置文件):
```
#!usr/bash/bin
#2020-4-20 13:57
#auto install LAMP+zentao
set -e
#Httpd
#判断执行文件是否已存在,若不存在,则yum安装httpd
if [ ! -f usr/sbin/httpd ];then
yum install httpd
fi
#设置Apache服务的启动级别
chkconfig --levels 235 httpd on
#启动apache
systemctl start httpd
#设置开机自启动
systemctl enable httpd
systemctl stop firewalld.service # 关闭防火墙
systemctl disable firewalld.service # 禁止firewall开机启动
#MariaDB
if [ ! -f usr/share/mariadb ];then
yum -y install mariadb-server mariadb
fi
#启动MariaDB
systemctl start mariadb.service
systemctl enable mariadb.service
#去掉表名的大小写敏感
cp /etc/my.cnf.d/server.cnf /etc/my.cnf
#PHP
if [ ! -f usr/bin/php ];then
yum install php php-devel php-mysqlnd
yum -y install php-pdo php-mbstring php-ldap php-gd php-json php-fpm
fi
systemctl restart php-fpm.service
#创建 phpinfo 文件, 测试 PHP 与 Apache 服务的整合:
echo '' > /var/www/html/index.php
#启动PHP
service php-fpm start
#zentao
#先下载源码包
wget http://dl.cnezsoft.com/zentao/12.3/ZenTaoPMS.12.3.stable.zip
unzip ZenTaoPMS.*.zip -d /var/www/html # 解压禅道源码包到web启动目录
systemctl restart httpd #重启httpd服务
```