ArchLinux安装SSPanel

一、安装相关依赖

pacman -S gnupg lsb-release

二、安装Nginx

pacman -S nginx nginx-mod-cache_purge nginx-mod-geoip2 nginx-mod-vts

nano -w /etc/nginx/nginx.conf

    include vhost/*.conf;
}

mkdir /etc/nginx/vhost && cd /etc/nginx/vhost

nano -w default.conf

server {
    listen 80 default_server;
    server_name v.example.com;
    if ($request_uri = "/") {
        rewrite ^(.*)$  https://$host$1 permanent;      
    }

    root        /srv/http/example.com;

    #charset koi8-r;

    access_log  /var/log/nginx/example.com.access.log;
    error_log   /var/log/nginx/example.com.error.log;

    location / {
        root         html;
        index        index.php index.html index.htm;
    }

    location ^~ /.well-known/acme-challenge/ {
        default_type "text/plain";
        root /srv/http/letsencrypt;
    }
}

nano -w default_ssl.conf

   listen 443 ssl default_server;
    server_name v.example.com;
    ssl_certificate /etc/nginx/ssl/v.example.com.pem;
    ssl_certificate_key /etc/nginx/ssl/v.example.com.key;
    ssl_session_timeout 5m;
    ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers on;

    #root        /srv/http/sspanel;
    root /srv/http/sspanel/public;
    index index.php;

    #charset koi8-r;

    access_log  /var/log/nginx/v.example.com.access.log;
    error_log   /var/log/nginx/v.example.com.error.log;

    location / {
        #root         /srv/http/v.example.com;
        #index        index.php index.html index.htm;
        try_files $uri /index.php$is_args$args;
    }

    location ~ \.php$ {
        try_files $fastcgi_script_name =404;
        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_buffers 8 16k;
        fastcgi_buffer_size 32k;
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    }

}

三、安装PHP

pacman -S php php-fpm php-redis php-gd php-xsl php-sodium

打开相关插件功能

sed -i 's/;extension=bcmath/extension=bcmath/g' /etc/php/php.ini
sed -i 's/;extension=bz2/extension=bz2/g' /etc/php/php.ini
sed -i 's/;extension=gd/extension=gd/g' /etc/php/php.ini
sed -i 's/;extension=mysqli/extension=mysqli/g' /etc/php/php.ini
sed -i 's/;zend_extension=opcache/zend_extension=opcache/g' /etc/php/php.ini
sed -i 's/;extension=pdo_mysql/extension=pdo_mysql/g' /etc/php/php.ini
sed -i 's/;extension=xsl/extension=xsl/g' /etc/php/php.ini
sed -i 's/;extension=sodium/extension=sodium/g' /etc/php/php.ini
sed -i 's/;extension=redis.so/extension.so=redis/g' /etc/php/conf.d/redis.ini
sed -i 's/;extension=igbinary.so/extension=igbinary.so/g' /etc/php/conf.d/igbinary.ini

启动 php-fpm 服务并设置开机启动

systemctl start php-fpm
systemctl enable php-fpm

四、安装数据库

pacman -S mariadb

启动 MariaDB 服务并设置开机启动

systemctl start mariadb
systemctl enable mariadb

初始化数据库

mariadb-install-db --user=mysql --basedir=/usr --datadir=/srv/mysql

修改数据库数据目录

nano -w /etc/my.cnf.d/server.cnf

[mysqld]
datadir = /srv/mysql

nano -w /etc/my.cnf.d/mysql-clients.cnf

[mysql]
password = password

重新启动MariaDB

systemctl restart mariadb

进入系统修改密码

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');

创建数据库

mysql> CREATE DATABASE sspanel CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
mysql> CREATE USER 'sspanel'@'localhost';
mysql> GRANT ALL PRIVILEGES ON sspanel.* TO 'sspanel'@'localhost' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;

五、安装redis

pacman -S redis

启动 redis-server 服务并设置开机启动

systemctl start redis
systemctl enable redis

六、安装sspanel

git clone -b 2023.5 https://github.com/Anankke/SSPanel-Uim.git .
wget https://getcomposer.org/installer -O composer.phar
php composer.phar
su http
php composer.phar install --no-dev

复制配置修改数据库信息

cp config/.config.example.php config/.config.php
cp config/appprofile.example.php config/appprofile.php
nano config/.config.php
php xcat Migration new
php xcat Tool importAllSettings
php xcat Tool createAdmin
sudo -u http /usr/bin/php xcat ClientDownload

关于Zeno Chen

本人涉及的领域较多,杂而不精 程序设计语言: Perl, Java, PHP, Python; 数据库系统: MySQL,Oracle; 偶尔做做电路板的开发,主攻STM32单片机
此条目发表在Linux分类目录。将固定链接加入收藏夹。