步骤
实验环境
- centos7虚拟机 ip:172.168.44.132
- apche mysql php
- farm源码包
安装所需软件包apache php mysql
yum -y install lrzsz
yum -y install httpd php php-mysql mariadb-server
上传farm源码包
wget -O 'farm-ucenter1.5.zip' 'https://pan.geekrabbit.top/?explorer/share/fileOut&shareID=7tywdr6g&path=%7BshareItemLink%3A7tywdr6g%7D%2Flinux%E5%9F%BA%E7%A1%80%2Ffarm%2Ffarm-ucenter1.5.zip'
unzip farm-ucenter1.5.zip //解压
mv upload/ /var/www/html/farm //解压好的文件移动到/var/www/html/farm
启动apache和mysql
systemctl enable --now httpd //开机自启并启动
systemctl enable --now mariadb //开机自启并启动mysql
安全初始化数据库
[root@localhost ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): //直接回车
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y #输入y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]y #输入y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y #输入y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y #输入y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y #输入y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
登陆数据库
mysql -uroot -p123456
> create database qqfarm; //创建数据库
> grant all on qqfarm.* to 'farmer'@'%' identified by '123';
> flush privileges; //更新权限
mysql -uroot -p123456 qqfarm < /var/www/html/farm/qqfarm.sql //导入数据库
编辑php配置文件
vim /etc/php.ini
short_open_tag = On //Off改成On
例:
209 Production Value: Off
210 ; http://php.net/short-open-tag
211 short_open_tag = On //Off改成On
212
213 ; Allow ASP-style <% %> tags.
给目录、文件设置权限
chmod -R 777 /var/www/html/farm/ //设置777权限
systemctl restart httpd //重启apache
浏览器访问
数据库名 qqfarm
数据库用户名
数据库名: qqfarm
数据库用户名: famer
密码都是: 123