Xiangxiang's Personal Site

Machine Learning & Security Engineer
生命不息,折腾不止,留下一点活着的记录.

View on GitHub
12 August 2017

Ubuntu server settings(持续更新中)

by xiangxiang

记录自己的vps基础配置

SSH settings

adduser shen
usermod -aG sudo shen # add shen to root group 
su shen
cd ~
mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
PasswordAuthentication no
PermitRootLogin no
Port 22221
sudo service ssh start

bbr

sudo echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
sudo echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sudo sysctl -p
sudo sysctl net.ipv4.tcp_available_congestion_control
# net.ipv4.tcp_available_congestion_control = bbr cubic reno
sudo lsmod | grep bbr

Firewall

sudo apt-get install ufw
sudo ufw allow 22221/tcp # SSH
sudo ufw allow 25387 # SS
sudo ufw allow 28888 # ResilioSync
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable

Shadowsocks

sudo apt update
sudo apt install shadowsocks-libev
{
    "server":"0.0.0.0",
    "server_port":25387,
    "local_address":"127.0.0.1",
    "local_port":1080,
    "password":"xxxxxxxxxxxxxxx",
    "timeout":600,
    "method":"aes-256-gcm"
}

ResilioSync

sudo echo "deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free" | sudo tee /etc/apt/sources.list.d/resilio-sync.list
sudo apt-get install curl -y
sudo apt-get install gnupg -y
curl -LO http://linux-packages.resilio.com/resilio-sync/key.asc && sudo apt-key add ./key.asc
sudo apt-get update
sudo apt-get install resilio-sync
{
    "storage_path" : "/var/lib/resilio-sync/",
    "pid_file" : "/var/run/resilio-sync/sync.pid",

    "webui" :
    {
        "listen" : "0.0.0.0:28888"
    }
}

开机自启动任务

[Unit]
Description=Intellij activication service
After=network.target


[Service]
User=nobody
Group=nogroup
Type=simple
ExecStart=/usr/local/bin/IntelliJIDEALicenseServer_linux_amd64 -p 18413 -u shenxx  2>&1> /dev/null

[Install]
WantedBy=multi-user.target
[Unit]
Description=KMS Server By vlmcsd
After=network.target

[Service]
Type=forking
PIDFile=/var/run/vlmcsd.pid
ExecStart=/usr/local/bin/vlmcsd-x64-glibc -p /var/run/vlmcsd.pid
ExecStop=/bin/kill -HUP $MAINPID
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target
tags: ubuntu vps ufw