yum install -y yum-fastestmirror lrzsz vim screen java-1.8.0-openjdk* mariadb mariadb-server redis nginx unzip zip wget net-tools #------------------------------安装java17 wget https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.rpm yum install -y amazon-corretto-17-x64-linux-jdk.rpm #------------------------------配置mysql8 wget https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm rpm -ivh mysql80-community-release-el7-11.noarch.rpm yum install -y mysql-server --nogpgcheck systemctl start mysqld mysql_secure_installation grep 'temporary password' /var/log/mysqld.log mysql -uroot -p SELECT user, host, plugin FROM mysql.user WHERE user = 'root'; -- 查看当前有哪些 root 用户: -- 1. 创建用户 'root'@'%'(如果不存在) CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'o6KRMJvFrHxS@'; -- 2. 授予所需权限(例如所有权限) GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; -- 3. 刷新权限 FLUSH PRIVILEGES; #------------------------------配置mariadb systemctl start mariadb systemctl enable mariadb mysql_secure_installation 回车-初始密码为空 y-设置密码 y-清楚匿名用户 n-允许远程登录 y-移除test库 y-重新装载权限 vi /etc/my.cnf #在[mysqld]标签下添加 init_connect='SET collation_connection = utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake vi /etc/my.cnf.d/client.cnf #在[client]中添加 default-character-set=utf8 vi /etc/my.cnf.d/mysql-clients.cnf #在[mysql]中添加 default-character-set=utf8 systemctl restart mariadb mysql -uroot -plL2oOkEc grant all privileges on *.* to 'root'@'%' identified by 'lL2oOkEc' with grant option; flush privileges; show variables like "%character%";show variables like "%collation%"; #------------------------------配置redis vim /etc/redis.conf 命令模式:/requirepass 命令模式:/bind systemctl start redis.service wget https://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/r/redis-3.2.12-2.el7.x86_64.rpm wget https://archives.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/j/jemalloc-3.6.0-1.el7.x86_64.rpm yum install -y jemalloc-3.6.0-1.el7.x86_64.rpm redis-3.2.12-2.el7.x86_64.rpm #------------------------------配置nginx vim /etc/nginx/nginx.conf systemctl start nginx.service # 安装编译依赖 sudo yum install -y gcc pcre-devel zlib-devel openssl-devel make # 下载源码(以 1.24.0 为例) wget https://nginx.org/download/nginx-1.24.0.tar.gz tar -xzf nginx-1.24.0.tar.gz cd nginx-1.24.0 # 编译安装 ./configure --prefix=/usr/local/nginx --with-http_ssl_module make -j$(nproc) make install # 启动 /usr/local/nginx/sbin/nginx ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx #------------------------------配置gohttpserver wget -P /usr/local/src/ https://github.com/codeskyblue/gohttpserver/releases/download/1.1.0/gohttpserver_1.1.0_linux_amd64.tar.gz https://github.com/codeskyblue/gohttpserver/releases/download/1.3.0/gohttpserver_1.3.0_linux_amd64.tar.gz tar -C /usr/local -xzf gohttpserver_1.1.0_linux_amd64.tar.gz wget -P /usr/local/src/ https://go.dev/dl/go1.24.3.linux-amd64.tar.gz #https://go.dev/dl/go1.24.3.linux-amd64.tar.gz tar -C /usr/local -xzf go1.16.4.linux-amd64.tar.gz echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile source /etc/profile go version mkdir /usr/local/share/bkk/ & cd /usr/local screen -S svn ./gohttpserver -r /usr/local/share/bkk --port 8000 --auth-type http --auth-http bkk:bkk --upload --delete =======通过域名访问配置nginx ./gohttpserver -r /usr/local/share/bkk --auth-type http --auth-http bkk:bkk --upload --delete --prefix /svn --addr :8000 --xheaders location /svn { proxy_pass http://127.0.0.1:8000; # here need to change proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; client_max_body_size 0; # disable upload limit } #------------------------------配置frp wget -P /usr/local/src/ https://github.com/fatedier/frp/releases/frp_0.43.0_linux_amd64.tar.gz tar -C /usr/local -xzf frp_0.43.0_linux_amd64.tar.gz cd /usr/local/frp_0.43.0_linux_amd64 ; vim frps.ini screen -S frp ./frps -c frps.ini nohup java -jar master_base-0.0.1_BASE.jar >>log.file 2>&1 & #------------------------------Ubuntu配置postgresql 官方文档:https://www.postgresql.org/download/linux/ 1、apt install postgresql 2、编辑主配置文件 /etc/postgresql//main/postgresql.conf 和客户端认证文件 /etc/postgresql//main/pg_hba.conf。 修改 postgresql.conf: listen_addresses = '*' 编辑 pg_hba.conf:添加一行 host all all 0.0.0.0/0 md5 3、ALTER USER postgres PASSWORD 'lL2oOkEc'; sudo -i -u postgres systemctl restart postgresql psql -U postgres -d postgres #------------------------------配置alist小雅 官方文档:https://alistgo.com/zh curl -fsSL "https://alist.nn.ci/v3.sh" -o v3.sh && bash v3.sh vim /etc/nginx/sites-available/default location /alist { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Range $http_range; proxy_set_header If-Range $http_if_range; proxy_redirect off; proxy_pass http://127.0.0.1:5244; # the max size of file to upload client_max_body_size 20000m; }