安装环境
PHP>= 7.3 MySQL
>= 5.6
fileinfo` 扩展
使用 Redis
缓存需安装 Redis
扩展
安装:上传主机设置运行目录public,访问域名/install在线安装
1、初始化服务器
关闭防火墙及Selinux
[root@chaosaigc ~]# systemctl stop firewalld && systemctl disable firewalld
[root@chaosaigc ~]# setenforce 0
[root@chaosaigc ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
2、安装Nginx
配置Nginxyum
源
[root@chaosaigc ~]# cat /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
安装并启动nginx
[root@chaosaigc ~]# yum install -y nginx
[root@chaosaigc ~]# systemctl restart nginx && systemctl enable nginx
编写toolbox
配置文件
[root@chaosaigc ~]# cat /etc/nginx/conf.d/px-toolbox.conf
server {
listen 80;
server_name localhost;
root /var/www/toolbox/public;
index index.php index.html index.htm;
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
}
重启nginx服务
[root@chaosaigc ~]# systemctl restart nginx
3、安装PHP
配置php yum
源
[root@chaosaigc ~]# cat /etc/yum.repos.d/remi-php74.repo
# This repository only provides PHP 7.4 and its extensions
# NOTICE: common dependencies are in "remi-safe"
[remi-php74]
name=Remi's PHP 7.4 RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/php74/$basearch/
#mirrorlist=https://rpms.remirepo.net/enterprise/7/php74/httpsmirror
mirrorlist=http://cdn.remirepo.net/enterprise/7/php74/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php74-debuginfo]
name=Remi's PHP 7.4 RPM repository for Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.remirepo.net/enterprise/7/debug-php74/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php74-test]
name=Remi's PHP 7.4 test RPM repository for Enterprise Linux 7 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/7/test74/$basearch/
#mirrorlist=https://rpms.remirepo.net/enterprise/7/test74/httpsmirror
mirrorlist=http://cdn.remirepo.net/enterprise/7/test74/mirror
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
[remi-php74-test-debuginfo]
name=Remi's PHP 7.4 test RPM repository for Enterprise Linux 7 - $basearch - debuginfo
baseurl=http://rpms.remirepo.net/enterprise/7/debug-test74/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
安装并启动php
[root@chaosaigc ~]# yum install -y php74 php74-php-devel php74-php-fpm php74-php-pdo php74-php-mysql php74-php-mysqli php74-php-xml php74-php-gd php74-php-imagick php74-php-mbstring php74-php-zip php74-php-intl zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel
[root@chaosaigc ~]# systemctl restart php74-php-fpm && systemctl enable php74-php-fpm
修改www.conf,将php-fpm启动用户修改为nginx
[root@chaosaigc ~]# vim /etc/opt/remi/php74/php-fpm.d/www.conf
user = nginx
group = nginx
重启php-fpm
[root@chaosaigc ~]# systemctl restart php74-php-fpm
4、安装数据库-Mysql
清理环境
[root@chaosaigc ~]# yum erase mariadb mariadb-server mariadb-libs mariadb-devel -y
[root@chaosaigc ~]# userdel -r mysql
[root@chaosaigc ~]# rm -rf /etc/my*
[root@chaosaigc ~]# rm -rf /var/lib/mysql
下载yum源的rpm安装包
[root@chaosaigc ~]# yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
[root@chaosaigc ~]# vim /etc/yum.repos.d/mysql-community.repo
把安装5.7的源打开, 关闭安装8.0的源
[root@chaosaigc ~]# yum install -y yum-utils
[root@chaosaigc ~]# yum repolist all |grep mysql
[root@chaosaigc ~]# yum-config-manager --disable mysql80-community
[root@chaosaigc ~]# yum-config-manager --enable mysql57-community
安装必要的软件包
[root@chaosaigc ~]# yum -y groupinstall "Development Tools"
[root@chaosaigc ~]# yum -y install mysql-community-server
[root@chaosaigc ~]# yum -y install mysql-community-server
[root@chaosaigc ~]# systemctl restart mysqld && systemctl enable mysqld
修改数据库密码
从日志中找出初始密码
[root@chaosaigc ~]# grep "password" /var/log/mysqld.log
2023-08-17T01:54:37.996805Z 1 [Note] A temporary password is generated for root@localhost: 86au6b_z6rD&
登录数据库
[root@chaosaigc ~]# mysql -uroot -p'86au6b_z6rD&'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8711
Server version: 5.7.43 MySQL Community Server (GPL)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# 修改数据库密码
mysql> alter user 'root'@'localhost' identified by "QianFeng@123";
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
创建数据库
[root@chaosaigc ~]# mysql -uroot -p'QianFeng@123'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8711
Server version: 5.7.43 MySQL Community Server (GPL)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# 修改数据库密码
mysql> create database toolbox;
mysql> exit
Bye
5、上传toolbox源码包
[root@chaosaigc ~]# wget https://blog-1305991344.cos.ap-beijing.myqcloud.com/uPic/toolbox.zip
[root@chaosaigc ~]# mkdir /var/www/ -p
[root@chaosaigc ~]# unzip toolbox.zip
[root@chaosaigc ~]# mv toolbox /var/www/
[root@chaosaigc ~]# cd /var/www/toolbox
[root@chaosaigc toolbox]# chown nginx.nginx ./
浏览器访问
通过浏览器访问,进行安装配置 http://192.168.137.148/install
安装后访问: http://192.168.137.148/
后台登录页面: http://192.168.137.148/admin
Comments | 1 条评论
哇