Last active
June 3, 2018 13:21
-
-
Save gavxin/bfea24ab127bacbce21a1a5e4afa7201 to your computer and use it in GitHub Desktop.
VPS set up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.1" | |
services: | |
ss: | |
image: 4con/ss-private | |
restart: always | |
ports: | |
- 443:8838/tcp | |
- 443:8838/udp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (Aliyun) Uninstall Agent and aliyun-service | |
wget http://update.aegis.aliyun.com/download/uninstall.sh | |
chmod +x uninstall.sh | |
./uninstall.sh | |
rm uninstall.sh | |
rm -rf /usr/local/aegis | |
rm /usr/sbin/aliyun-service | |
rm /etc/init.d/agentwatch | |
# (Aliyun) Uninstall other services | |
sudo systemctl stop accounts-daemon.service | |
sudo systemctl disable accounts-daemon.service | |
sudo systemctl stop aliyun-util.service | |
sudo systemctl disable aliyun-util.service | |
sudo systemctl stop cloud-config.service | |
sudo systemctl disable cloud-config.service | |
sudo systemctl stop cloud-final.service | |
sudo systemctl disable cloud-final.service | |
sudo systemctl stop cloud-init-local.service | |
sudo systemctl disable cloud-init-local.service | |
sudo systemctl stop cloud-init-upgrade.service | |
sudo systemctl disable cloud-init-upgrade.service | |
sudo systemctl stop cloud-init.service | |
sudo systemctl disable cloud-init.service | |
# (Aliyun) remove /etc/motd | |
rm /etc/motd | |
# Enable bbr on Debian 9 | |
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf | |
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf | |
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf | |
sysctl -p | |
## Check if running bbr | |
sysctl net.ipv4.tcp_available_congestion_control | |
sysctl net.ipv4.tcp_congestion_control | |
lsmod | grep bbr | |
# update apt | |
apt update | |
apt upgrade | |
# Install docker for debian 9 from convenience script | |
curl -fsSL get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
# Install docker for debian 9 from repo | |
sudo apt-get install \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg2 \ | |
software-properties-common | |
## Add GPG key | |
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add - | |
## Check fingerprint | |
sudo apt-key fingerprint 0EBFCD88 | |
## add apt repo | |
sudo add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \ | |
$(lsb_release -cs) \ | |
stable" | |
apt update | |
## docker-compose optional. see https://github.com/docker/compose/releases | |
curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
## docker-machine optional. see https://github.com/docker/machine/releases | |
curl -L https://github.com/docker/machine/releases/download/v0.13.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && | |
chmod +x /tmp/docker-machine && | |
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine | |
## swarm register | |
docker swarm init | |
docker run -ti --rm -v /var/run/docker.sock:/var/run/docker.sock dockercloud/registration | |
### input username and pass | |
### after register can use | |
### docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -e DOCKER_HOST dockercloud/client | |
### to access this cluster | |
# Pull private image. | |
docker login | |
docker pull 4con/ss-private | |
# Save docker-compose.yml and run... | |
docker-compose up -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# update apt | |
apt update | |
apt upgrade | |
# Enable bbr on Debian 9 | |
echo "tcp_bbr" >> /etc/modules-load.d/modules.conf | |
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf | |
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf | |
sysctl -p | |
# Install docker for debian 9 from convenience script | |
curl -fsSL get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
# docker-compose | |
curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
# Pull private image. | |
docker login | |
docker pull 4con/ss-private | |
# Save docker-compose.yml and run... | |
docker-compose up -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment