一、关闭防火墙和SElinux

1
2
3
4
5
6
systemctl stop firewalld
systemctl disable firewalld
systemctl mask firewalld
vim /etc/selinux/config
SELINUX=disabled
setenforce 0

二、配置Yum源和Epel源(国内源)
如果没有wget命令,请安装yum install -y wget

1
2
3
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
yum clean all && yum makecache fast

三、安装Nginx(自己编译)

A.下载Nginx安装包

1
wget http://nginx.org/download/nginx-1.20.2.tar.gz

B.安装必要的依赖

1
yum install -y gcc openssl-devel pcre-devel zlib-devel 

C.创建Nginx临时文件目录

1
mkdir -p /var/tmp/nginx/{client,proxy,fastcgi,uwsgi,scgi}

D.创建Nginx用户

1
useradd -s /sbin/nologin nginx 

E.解压Nginx

1
2
tar xf nginx-1.20.2.tar.gz
cd nginx-1.20.2/

F.编译并安装

1
2
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-stream --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-file-aio --with-http_secure_link_module --with-threads --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi/ --http-scgi-temp-path=/var/tmp/nginx/scgi/
make && make install

暂时不要启动Nginx

四、安装PHP8.1
A.配置epel源

1
yum install -y epel-release

B.配置REMI

1
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

C.安装yum-utils

1
yum install -y yum-utils

D.安装PHP8.1

1
2
yum-config-manager --enable remi-php81
yum install -y php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-redis

E.查询PHP版本

1
php -version

PHP 8.1.18 (cli) (built: Apr 11 2023 16:47:45) (NTS gcc x86_64)
Copyright © The PHP Group
Zend Engine v4.1.18, Copyright © Zend Technologies

F.启动PHP和Nginx

1
2
systemctl enable --now php-fpm
/usr/local/nginx/sbin/nginx

G.修改PHP用户

1
2
3
vim /etc/php-fpm.d/www.conf
user = nginx #把默认的apache改成nginx
group = nginx

H.重启PHP

1
systemctl restart php-fpm

I.可以查看端口状态,是否成功启动

1
netstat -tunlp | grep -e "nginx" -e "php"

如果没有netstat命令,请安装

1
yum install -y net-tools

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6852/nginx: master
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 6845/php-fpm: master

五、安装MariaDB10.6
1.安装MariaDB
A.配置yum源

1
2
3
4
5
6
vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = https://mirrors.aliyun.com/mariadb/yum/10.6/centos7-amd64
gpgkey=https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

B.安装MariaDB

1
yum install -y MariaDB-server MariaDB-client

C.设置开机自启动

1
systemctl enable --now mariadb

D.初始化设置MariaDB

1
mariadb-secure-installation

Enter current password for root (enter for none): 输入当前的root密码(默认空),直接回车
Set root password? [Y/n] 设置新密码,y
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

E.创建用到的库

1
CREATE DATABASE ssp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

F.创建用户和给予权限

1
2
CREATE USER 'ssp'@'localhost';
GRANT ALL PRIVILEGES ON ssp.* TO 'ssp'@'localhost' IDENTIFIED BY 'isay.life';

G.刷新用户数据

1
FLUSH PRIVILEGES;

H.退出数据库

1
exit

六、安装SSPanel UIM
1.配置Nginx
A.创建网页目录
我这里在根目录创建home目录做演示

1
mkdir -p /home

A.创建子配置文件目录

1
mkdir -p /usr/local/nginx/conf.d

B.创建子配置文件

1
vim /usr/local/nginx/conf.d/你设置的网站域名.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
server {  
listen 80;
listen [::]:80;
root /path/to/your/site/public; #你的站点文件路径 + /public
index index.php index.html;
server_name 你设置的网站域名;

location / {
try_files $uri /index.php$is_args$args;
}

location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php-fpm; #如果检测这里报错,请更换为IP+端口,比如127.0.0.1:9000
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

C.修改主配置文件
把我们刚刚写好的子配置文件引用到主配置文件内

1
2
vim /usr/local/nginx/conf/nginx.conf
include /usr/local/nginx/conf.d/*.conf;

D.检查配置文件

1
/usr/local/nginx/sbin/nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
E.重新加载配置文件

1
/usr/local/nginx/sbin/nginx -s reload

2.前往网站根目录下载需要的文件
A.前往网站根目录
cd /home
B.安装Git环境
如果提示找不到包,请配置epel源!

1
yum install -y git

C.克隆项目

1
2
3
4
git clone -b dev https://github.com/Anankke/SSPanel-Uim.git
cd SSPanel-Uim/
git config core.filemode false
wget https://getcomposer.org/installer -O composer.phar

如果没有wget命令,请安装yum install -y wget

1
2
php composer.phar
php composer.phar install

D.给予网页目录权限

1
2
chmod -R 755 /你的网页目录
chown -R nginx.nginx /你的网页目录

E.修改属主和属组

F.修改数据库连接信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cp config/.config.example.php config/.config.php
cp config/appprofile.example.php config/appprofile.php
vim config/.config.php
$_ENV['db_driver'] = 'mysql';
$_ENV['db_host'] = 'localhost';
$_ENV['db_socket'] = '';
$_ENV['db_database'] = 'ssp'; //数据库名
$_ENV['db_username'] = 'ssp'; //数据库用户名
$_ENV['db_password'] = 'isay.life'; //用户名对应的密码
$_ENV['db_port'] = '3306'; //端口
#高级
$_ENV['db_charset'] = 'utf8mb4';
$_ENV['db_collation'] = 'utf8mb4_unicode_ci';
$_ENV['db_prefix'] = '';
仅展示修改数据库的地方,其他地方按需修改

G.站点初始化

1
2
3
4
php xcat Migration new
php xcat Tool importAllSettings
php xcat Tool createAdmin
php xcat ClientDownload

SSP没有安装ssl是无法正常使用的
我们进行ssl证书的生成
关闭Nginx
/usr/local/nginx/sbin/nginx -s stop
A.安装

1
yum install certbot

B.创建

1
certbot certonly --standalone -d dome.com

重启Nginx

1
/usr/local/nginx/sbin/nginx -s reload

H.设置计划任务

1
crontab -e
1
2
3
4
*/5 * * * * /usr/bin/php /home/SSPanel-Uim/xcat  Cron
*/1 * * * * /usr/bin/php /home/SSPanel-Uim/xcat Job CheckJob
0 */1 * * * /usr/bin/php /home/SSPanel-Uim/xcat Job UserJob
0 0 * * * /usr/bin/php -n /home/SSPanel-Uim/xcat Job DailyJob

以下是可选的

1
2
3
4
5 0 * * * /usr/bin/php /vpn/sspanel/xcat FinanceMail day 
6 0 * * 0 /usr/bin/php /vpn/sspanel/xcat FinanceMail week
7 0 1 * * /usr/bin/php /vpn/sspanel/xcat FinanceMail month
*/1 * * * * /usr/bin/php /vpn/sspanel/xcat DetectGFW