Linux a-nomad Documentation

website·Indexed 31 days ago

https://linux.a-nomad.com/

A comprehensive guide to Linux system administration and networking. Topics include basic command-line operations, file and directory management, permission settings, and system maintenance. It also provides installation and configuration guides for Nginx, MySQL, FTP, and networking tools such as V2Ray, Brook, WireGuard, and Telegram.

Tokens
10.4K
Snippets
78
Records
90
Agent score
51%

What's inside Linux a-nomad

  1. Overview of Brook Proxy

    Brook is a high-performance Socks5 proxy software written in Golang. It supports multiple platforms including Windows, Linux, macOS, iOS, Android, and Raspberry Pi.

    Key features include:

    • Support for Brook (new version), Stream Brook (old version), Shadowsocks, and SOCKS5 protocols.
    • TCP/UDP forwarding (UDP forwarding works without additional configuration).
    • SOCKS5 to HTTP proxy conversion.
    • Support for single-port and multi-port configurations (each port can have a unique password).
  2. Understand the Linux Kernel and Distributions

    The Linux operating system consists of two primary components: the Kernel and the Distribution.

    1. Linux Kernel: The core program that manages hardware devices and runs applications, acting as an abstraction layer between hardware and software. It is available in two versions:

      • Stable Version: Industrial-grade, used for wide deployment, focusing on bug fixes and new drivers.
      • Development Version: Rapidly updated to test new solutions.
      • Source code is available at https://www.kernel.org.
    2. Linux Distributions (GNU/Linux): Complete operating systems built by adding toolsets and software on top of the Linux kernel. Common distributions include Ubuntu, RedHat, CentOS, Debian, Fedora, SuSE, OpenSUSE, Arch Linux, and SolusOS.

  3. Install Brook server using official scripts on Linux

    To install the Brook server manually using the official binary, switch to the root user, synchronize the system time, and execute the binary. To run Brook as a background service (example for Debian 9), use screen to launch the server with a specified port and password.
    # Switch to root
    sudo -i
    # Sync time to Asia/Shanghai
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    
    # Download and install official binary (check https://github.com/txthinking/brook/releases for latest version)
    wget https://github.com/txthinking/brook/releases/download/v20181212/brook
    chmod -R 744 brook
    ./brook
    
    # Start as a background service using screen
    # -l specifies the port, -p specifies the password
    screen -dmS brook ./brook server -l :5468 -p xinzhe468brook
  4. Set up a V2Ray server on Debian 8 using v2-ui

    To set up a V2Ray server on Debian 8, you can use the v2-ui management panel which includes the official V2Ray package. The process involves setting the system timezone, enabling BBR for network optimization, and running the v2-ui installation script. Once installed, V2Ray can be configured via a graphical web interface.
    # Switch to root
    sudo -i
    
    # Set timezone to Asia/Shanghai
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    
    # Enable Debian built-in BBR congestion control
    echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf 
    echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf 
    sysctl -p 
    sysctl net.ipv4.tcp_available_congestion_control 
    lsmod | grep bbr
    
    # Install v2-ui (includes V2Ray official package)
    bash <(curl -Ls https://blog.sprov.xyz/v2-ui.sh)
  5. Visualize directory structure with the tree command

    The tree command displays directory contents in a tree-like format, including hierarchical subdirectories and files. If not installed, use sudo apt install tree.
    # Display tree for current directory
    $ tree
    
    # Display only directories for ~/Desktop
    $ tree -d ~/Desktop
  6. Install and serve a GitBook documentation site

    To install the GitBook CLI globally and start a local documentation server for the project, use the following commands.
    npm install gitbook-cli -g
    gitbook install
    gitbook serve
  7. Install and configure vsftpd on Debian/Ubuntu

    Install the vsftpd package and configure it to allow local users to upload or delete files. After modifying the configuration file, the service must be restarted for changes to take effect. Ensure port 21 is open in your firewall.
    # Install vsftpd
    sudo apt install vsftpd
    
    # Edit configuration file
    # File location: /etc/vsftpd.conf
    # Set the following options:
    # anonymous_enable=NO  (Disable anonymous users)
    # local_enable=YES     (Allow local login)
    # write_enable=YES     (Allow upload/delete operations)
    
    # Restart service
    sudo service vsftpd restart
  8. Monitor and manage processes with ps, top, and kill

    Linux provides several tools for process management:

    • ps: Displays process snapshots. Note that options for ps often do not use a leading dash (e.g., ps aux).
    • top: Provides a dynamic, real-time view of processes. While running, use M to sort by memory, P by CPU, and K to kill a process by PID.
    • kill: Terminates a process. Use signal 9 for a forced termination.
    # Show processes for current user in current terminal
    ps
    
    # Show detailed processes for all users in terminals
    ps au
    
    # Show all processes including those not started in a terminal
    ps aux
    
    # Forcefully terminate process with PID 1278
    kill -9 1278
  9. Basic vi/vim editor operation

    vi (and the improved vim) is a modal text editor. It primarily operates in two modes:

    1. Command Mode: The default mode upon opening. Keys are interpreted as commands. Press ESC from any other mode to return here.
    2. Edit Mode: Used for entering text. Entered from Command Mode using keys like i (insert), a (append), o (open new line), c (change), r (replace), or s (substitute).
    # Open a file for editing (creates the file if it doesn't exist)
    $ vi [filename]
  10. Deploy an MTProxy server using Docker

    Telegram supports SOCKS5 and MTProxy. MTProxy is specifically designed by Telegram for its application. You can quickly deploy an MTProxy server on a Linux environment (e.g., Debian 9) using the official Docker image. After running the container, you can retrieve the proxy connection string from the logs.
    # Run the MTProxy docker container
    docker run -d -p 443:443 --name=mtproto-proxy --restart=always -v proxy-config:/data telegrammessenger/proxy
    
    # View proxy information to get the connection string
    docker logs mtproto-proxy
  11. Switch between Linux users

    The su (substitute user) command is used to switch identities. Using the - or -l option ensures the environment is switched to the target user's home directory.
    # Switch to user 'test' and move to their home directory
    su - test
    
    # Switch to the root user
    su
    # OR
    sudo -i
    
    # Exit the current user session
    exit
  12. Deploy Brook-Web for GUI management via Docker

    Brook-Web is a Python-based web interface that allows users to manage Brook, Shadowsocks, and Socks5 proxy accounts via a browser. The recommended deployment method is using Docker. After deployment, access the interface at http://<your-ip>. The default credentials are admin / admin.
    sudo -i
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    
    # Install Docker
    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    
    # Run Brook-Web container on port 80
    docker run --net=host -d capton/brook-web /bin/bash -c "python brook-web.py 80"