Skip to content

Instantly share code, notes, and snippets.

@onewayticket255
Last active March 1, 2020 17:03
Show Gist options
  • Save onewayticket255/d81f7230cdd95dbbf7e00787157f939c to your computer and use it in GitHub Desktop.
Save onewayticket255/d81f7230cdd95dbbf7e00787157f939c to your computer and use it in GitHub Desktop.
#!bin/sh
prerequisite(){
sudo -i
pacman -Syu aria2 nginx shadowsocks-libev simple-obfs node jq unzip
cd /
mkdir /sync
curl -L -o /sync/arch.sh https://gist.githubusercontent.com/onewayticket255/d81f7230cdd95dbbf7e00787157f939c/raw/arch.sh
chmod 777 /sync/arch.sh
/sync/arch.sh
}
echo "Configure openssh"
sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
systemctl restart sshd
cat>/root/.ssh/authorized_keys<<EOF
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDRYtydWJYLKaH0jqy2v/VfBxQTquoTUcvx0xWyazgX5Q74n/NtyNgc0LuiCYe/z4aG6T66XinVOJP+QTvU4yRFT3mu07MeKSt5RJ0l6Pr58zQCDmuG4i4xrYdjVcuMQ3t5XDETBOSN5X4OXN4prkAnAXHLweiKhhZwGJ40asOcPQF+AVGfQEKG454BtuDLmHu7aV4up41NXTJ/PIA7dOopJed9tGNbE6piXWaVeGBrzQiKLjR8bFcuzhjmTho4bFeyJqCJ6xh2N/gFeUBNgo9enkAykSisOcDK0kwW/YCNsxcMyrWXunroYN6KittVaIHIhm5cLxb7GW20l1G7XEPka43XSzAOVEyxKTPgTLfROO0Qg+qHE5CtVpGdRHyDq2rLxqTtngwcQvKna4GMYtGZPkVUJo3ToGAmo94aHTM8k+Mx4ZuOgpq1KajFPeeQakKme4DQABiCbp08uIEBFnBHqX9eTF6w4AKony8Oi/UQI5bNahF9EP5TsPdIZfLTsh9DGFQpiopTCwmGOGi17nLfjEFA4MFa7uAtlltgM8hoIWq2dvMmBUp5TjYwTeWBBUdFXvQDTpE6pwzzvaus38D0vx+SHvaVpP7LsIYwul6RUV9BBbgsnkAXNggP8LRRKvbhEWPmoapR0iFjrmIEGTT51Fhb+Eud4b3bZMaYEMfBiQ==
EOF
echo "Configure aria2"
cat>/sync/aria2.conf<<EOF
dir=/sync/Downloads
async-dns=false
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
rpc-listen-port=6800
max-concurrent-downloads=3
continue=true
max-connection-per-server=16
min-split-size=10M
split=16
max-overall-download-limit=0
max-download-limit=0
max-overall-upload-limit=0
max-upload-limit=0
file-allocation=prealloc
bt-enable-lpd=true
enable-dht=true
listen-port=6881-6999
seed-time=0
EOF
cat>/etc/systemd/system/aria2.service<<EOF
[Unit]
Description=aria2
[Service]
ExecStart=/bin/bash -c '\$\$(which aria2c) --conf-path /sync/aria2.conf'
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl start aria2
systemctl enable aria2
ariaurl=$(curl https://api.github.com/repos/mayswind/AriaNg/releases/latest | jq -r '.assets[0].browser_download_url')
echo $ariaurl
curl -L -o /sync/AriaNg.zip $ariaurl
cd /sync
unzip AriaNg.zip
echo "Configure Nginx"
mkdir /sync/Downloads
cat>/etc/nginx/nginx.conf<<EOF
worker_processes auto;
events {
worker_connections 1024;
}
http{
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
sendfile on;
server{
listen 8090;
server_name file;
charset UTF-8;
location / {
root /sync/Downloads;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
}
server {
listen 8080;
server_name aria2ng;
charset UTF-8;
location / {
root /sync;
index index.html;
}
}
}
EOF
systemctl restart nginx
systemctl enable nginx
echo "Configure shadowsocks"
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
lsmod | grep bbr
cat>/etc/systemd/system/ss.service<<EOF
[Unit]
Description=ss
[Service]
ExecStart=/bin/bash -c '\$\$(which ss-server) -s 0.0.0.0 -p 6666 -m chacha20-ietf-poly1305 -k 12345 --plugin obfs-server --plugin-opts obfs=http --fast-open -u'
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl start ss
systemctl enable ss
echo "ENJOY NOW"
#!bin/sh
prerequisite(){
sudo -i
apt update
apt install aria2 nginx shadowsocks-libev simple-obfs jq unzip nodejs
cd /
mkdir /sync
curl -L -o /sync/ubuntu.sh https://gist.githubusercontent.com/onewayticket255/d81f7230cdd95dbbf7e00787157f939c/raw/ubuntu.sh
chmod 777 /sync/ubuntu.sh
echo "Configure openssh"
sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
systemctl restart sshd
cat>/root/.ssh/authorized_keys<<EOF
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDRYtydWJYLKaH0jqy2v/VfBxQTquoTUcvx0xWyazgX5Q74n/NtyNgc0LuiCYe/z4aG6T66XinVOJP+QTvU4yRFT3mu07MeKSt5RJ0l6Pr58zQCDmuG4i4xrYdjVcuMQ3t5XDETBOSN5X4OXN4prkAnAXHLweiKhhZwGJ40asOcPQF+AVGfQEKG454BtuDLmHu7aV4up41NXTJ/PIA7dOopJed9tGNbE6piXWaVeGBrzQiKLjR8bFcuzhjmTho4bFeyJqCJ6xh2N/gFeUBNgo9enkAykSisOcDK0kwW/YCNsxcMyrWXunroYN6KittVaIHIhm5cLxb7GW20l1G7XEPka43XSzAOVEyxKTPgTLfROO0Qg+qHE5CtVpGdRHyDq2rLxqTtngwcQvKna4GMYtGZPkVUJo3ToGAmo94aHTM8k+Mx4ZuOgpq1KajFPeeQakKme4DQABiCbp08uIEBFnBHqX9eTF6w4AKony8Oi/UQI5bNahF9EP5TsPdIZfLTsh9DGFQpiopTCwmGOGi17nLfjEFA4MFa7uAtlltgM8hoIWq2dvMmBUp5TjYwTeWBBUdFXvQDTpE6pwzzvaus38D0vx+SHvaVpP7LsIYwul6RUV9BBbgsnkAXNggP8LRRKvbhEWPmoapR0iFjrmIEGTT51Fhb+Eud4b3bZMaYEMfBiQ==
EOF
echo "Configure aria2"
cat>/sync/aria2.conf<<EOF
dir=/sync/Downloads
async-dns=false
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
rpc-listen-port=6800
max-concurrent-downloads=3
continue=true
max-connection-per-server=16
min-split-size=10M
split=16
max-overall-download-limit=0
max-download-limit=0
max-overall-upload-limit=0
max-upload-limit=0
file-allocation=prealloc
bt-enable-lpd=true
enable-dht=true
listen-port=6881-6999
seed-time=0
EOF
cat>/etc/systemd/system/aria2.service<<EOF
[Unit]
Description=aria2
[Service]
ExecStart=/bin/bash -c '\$\$(which aria2c) --conf-path /sync/aria2.conf'
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl start aria2
systemctl enable aria2
ariaurl=$(curl https://api.github.com/repos/mayswind/AriaNg/releases/latest | jq -r '.assets[0].browser_download_url')
echo $ariaurl
curl -L -o /sync/AriaNg.zip $ariaurl
cd /sync
unzip AriaNg.zip
echo "Configure Nginx"
mkdir /sync/Downloads
cat>/etc/nginx/nginx.conf<<EOF
worker_processes auto;
events {
worker_connections 1024;
}
http{
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
sendfile on;
server{
listen 8090;
server_name file;
charset UTF-8;
location / {
root /sync/Downloads;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
}
server {
listen 8080;
server_name aria2ng;
charset UTF-8;
location / {
root /sync;
index index.html;
}
}
}
EOF
systemctl restart nginx
systemctl enable nginx
echo "Configure shadowsocks"
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
lsmod | grep bbr
cat>/etc/systemd/system/ss.service<<EOF
[Unit]
Description=ss
[Service]
ExecStart=/bin/bash -c '\$\$(which ss-server) -s 0.0.0.0 -p 6666 -m chacha20-ietf-poly1305 -k 12345 --plugin obfs-server --plugin-opts obfs=http --fast-open -u'
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl start ss
systemctl enable ss
echo "ENJOY NOW"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment