Skip to content

Instantly share code, notes, and snippets.

@itsuki-hayashi
Last active November 24, 2019 08:53
Show Gist options
  • Save itsuki-hayashi/cdb8c656e28a3d03f3f16092d87bfb10 to your computer and use it in GitHub Desktop.
Save itsuki-hayashi/cdb8c656e28a3d03f3f16092d87bfb10 to your computer and use it in GitHub Desktop.
# Enable Automatic Updates
sudo dnf config-manager --set-enabled PowerTools
sudo yum update -y
sudo yum install -y dnf-automatic
sudo sed -i 's/apply_updates = no/apply_updates = yes/' /etc/dnf/automatic.conf
sudo systemctl enable --now dnf-automatic.timer
# Download Shadowsocks source code
# cd /tmp
# wget https://github.com/shadowsocks/shadowsocks-libev/releases/download/v3.2.5/shadowsocks-libev-3.2.5.tar.gz
# tar -xvf shadowsocks-libev-3.2.5.tar.gz
# cd shadowsocks-libev-3.2.5/
# sudo yum install -y gcc pcre-devel asciidoc xmlto mbedtls-devel libsodium-devel c-ares-devel libev-devel make
# CFLAGS='-O2 -march=native -mtune=native' ./configure
# make
# sudo make install
# sudo yum remove -y gcc pcre-devel asciidoc xmlto mbedtls-devel libsodium-devel c-ares-devel libev-devel make
# sudo yum install -y libev libsodium mbedtls
# sudo groupadd shadowsocks
# sudo useradd -r -s /usr/sbin/nologin -g shadowsocks shadowsocks
# sed -i 's/LimitNOFILE=32768/LimitNOFILE=65536/' debian/shadowsocks-libev.service
# sed -i 's/\/usr\/bin\/ss-server/\/usr\/local\/bin\/ss-server/' debian/shadowsocks-libev.service
# sed -i 's/nobody/shadowsocks/' debian/shadowsocks-libev.service
# sed -i 's/nogroup/shadowsocks/' debian/shadowsocks-libev.service
# sudo cp debian/shadowsocks-libev.default /etc/default/shadowsocks-libev
# sudo cp debian/shadowsocks-libev.service /etc/systemd/system/
# sudo mkdir /etc/shadowsocks-libev/
# cat > debian/config.json <<END
# {
# "server": ["0.0.0.0"],
# "server_port": 8080,
# "password": "free-hong-kong",
# "timeout": 60,
# "method": "aes-256-gcm",
# "fast_open": true,
# "nameserver": "2001:4860:4860::8888,2001:4860:4860::8844,8.8.8.8,8.8.4.4",
# "dscp": 46,
# "plugin": "v2ray",
# "plugin_opts": "server"
# }
# END
# sudo cp debian/config.json /etc/shadowsocks-libev/config.json
# Install V2Ray plugin
# wget https://github.com/shadowsocks/v2ray-plugin/releases/download/v1.2.0/v2ray-plugin-linux-amd64-v1.2.0.tar.gz
# tar -xvf v2ray-plugin-linux-amd64-v1.2.0.tar.gz
# sudo cp v2ray-plugin_linux_amd64 /usr/local/bin/v2ray
# Install PHP and Apache
sudo yum install -y php php-gd php-json php-mbstring php-mysqlnd php-xml php-process php-intl php-pecl-apcu
sudo systemctl enable httpd
sudo systemctl start httpd
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
# Install WordPress
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xvf latest.tar.gz
sudo cp -R wordpress/ /var/www/
sudo chown -R apache:apache /var/www/wordpress
wget https://releases.wikimedia.org/mediawiki/1.33/mediawiki-1.33.1.tar.gz
tar -xvf mediawiki-1.33.1.tar.gz
sudo mkdir /var/www/mediawiki/
sudo cp -R mediawiki-1.33.1/* /var/www/mediawiki/
sudo chown -R apache:apache /var/www/mediawiki/
# Certbot
cd /tmp
wget https://dl.eff.org/certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo chown root /usr/local/bin/certbot-auto
sudo chmod 0755 /usr/local/bin/certbot-auto
sudo /usr/local/bin/certbot-auto certonly --apache
echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew" | sudo tee -a /etc/crontab > /dev/null
# V2Ray
wget https://github.com/v2ray/v2ray-core/releases/download/v4.21.3/v2ray-linux-64.zip
sudo cp /tmp/v2ctl /usr/local/bin/
sudo cp /tmp/v2ray /usr/local/bin/
# Prosody
yum install lua-dbi prosody
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment