Skip to content

Instantly share code, notes, and snippets.

@jhcao23
Last active December 11, 2023 07:47
Show Gist options
  • Save jhcao23/6d5851eb6056d737faf4093cefb2a0ac to your computer and use it in GitHub Desktop.
Save jhcao23/6d5851eb6056d737faf4093cefb2a0ac to your computer and use it in GitHub Desktop.
install shadowsocks on digitalocean

Here's the revised summary of the key points covered today:

  1. Updating Ubuntu: Use sudo apt update && sudo apt upgrade -y for package updates and sudo do-release-upgrade for OS upgrades.
  2. Installing Shadowsocks: Install using sudo apt install shadowsocks-libev.
  3. Configuring Shadowsocks: Modify /etc/shadowsocks-libev/config.json for server settings.
  4. Logging: Include "logfile": "/var/log/shadowsocks.log" in the config, ensuring correct permissions.
  5. Managing Shadowsocks Service: Restart with sudo systemctl restart shadowsocks-libev and check its status.
  6. Launching New Instances: For additional users, create new configuration and service files, ensuring unique ports and passwords.
  7. Auto-Restart: Enable automatic restart on boot with sudo systemctl enable shadowsocks-libev.service.
  8. Monitoring Logs: Use sudo journalctl -u shadowsocks-libev for detailed service logs.

This encompasses installation, configuration, and management of Shadowsocks on Ubuntu, including setting up multiple instances for different users.

Second Intance

To set up a second Shadowsocks instance with a unique port and password:

  1. Create a New Configuration File:

    • Copy and modify the existing configuration:
      sudo cp /etc/shadowsocks-libev/config.json /etc/shadowsocks-libev/config2.json
    • Edit config2.json to change server_port and password.
  2. Duplicate and Modify the Service File:

    • Copy the systemd service file:
      sudo cp /lib/systemd/system/shadowsocks-libev.service /lib/systemd/system/shadowsocks-libev2.service
    • Modify shadowsocks-libev2.service: EnvironmentFile=/etc/default/shadowsocks-libev2
  3. Update Environment File:

    • Copy and modify the environment file:
      sudo cp /etc/default/shadowsocks-libev /etc/default/shadowsocks-libev2
    • Update /etc/default/shadowsocks-libev2 to point to config2.json.
  4. Start and Enable New Service:

    • Reload systemd, start and enable the new service:
      sudo systemctl daemon-reload
      sudo systemctl start shadowsocks-libev2.service
      sudo systemctl enable shadowsocks-libev2.service
      sudo systemctl status shadowsocks-libev2

Ensure each instance uses unique ports to prevent conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment