Category: Debian

  • Install ShadowSocks server on Debian 10

    To install ShadowSocks server on Debian 10, run

    apt install -y shadowsocks
    

    Create config file

    vi /etc/shadowsocks/config.json
    

    Add following

    {
        "server":"SERVER_IP",
        "server_port":8044,
        "local_port":0,
        "password":"PASSWOARD_HERE",
        "timeout":600,
        "method":"aes-256-cfb"
    }
    

    You can change server_port if required.

    To enable service, run

    systemctl enable shadowsocks-server@config
    

    To start shadowsocks proxy, run

    systemctl start shadowsocks-server@config
    

    For status/restart

    systemctl status shadowsocks-server@config
    systemctl restart shadowsocks-server@config
    
  • Install RabbitMQ on Ubuntu/Debian

    To install rabbitmq on Ubuntu/Debian, run

    echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list
    wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
    apt update
    apt install rabbitmq-server
    

    To start RabbitMQ server, run

    service rabbitmq-server start
    
  • How to upgrade Debian 9 to Debian 10

    How to upgrade Debian 9 to Debian 10

    To upgrade Debian 9 to Debian 10, first make sure your system is up-to-date.

    apt update && apt upgrade -y
    

    Edit file /etc/apt/sources.list. Find all occurrences of “stretch” and replace it with “buster”.

    sed -i 's/stretch/buster/g' /etc/apt/sources.list

    Or use following

    deb http://cloudfront.debian.net/debian/ buster main non-free contrib
    deb-src http://cloudfront.debian.net/debian/ buster main non-free contrib
    
    deb http://security.debian.org/debian-security buster/updates main contrib non-free
    deb-src http://security.debian.org/debian-security buster/updates main contrib non-free

    Now update the system

    apt update && apt upgrade -y

    run dist-upgrade

    apt dist-upgrade -y

    During the upgrade, you will be asked to replace some of the configuration files. If this is a fresh server, you can always replace these files with a newer version. If your server has these files modified, you should be careful as replacing these files will lose the changes you made.

    Debian 10 upgrade

    Reboot the server.

    reboot

    After reboot, you can verify the server is running Debian 10 with commands

    lsb_release -a
    hostnamectl
    Debian 10

  • Installing r1soft server backup agent on Debian/Ubuntu

    To install r1soft server backup agent on Ubuntu/Debian, add repository

    echo deb http://repo.r1soft.com/apt stable main >> /etc/apt/sources.list
    wget http://repo.r1soft.com/r1soft.asc
    apt-key add r1soft.asc
    

    Install agent

    apt update
    apt -y install serverbackup-enterprise-agent
    

    Install kernal headers

    apt install linux-headers-`uname -r`
    

    Install kernal modules

    serverbackup-setup --get-module
    

    Verify backup agent works with

    serverbackup-setup --test-connection
    

    Start backup agent

    /etc/init.d/cdp-agent restart
    

    Now you can add the server to R1Soft Backup Manager.

  • Upgrade Debian 8 Jessie To Debian 9 Stretch

    Upgrade Debian 8 Jessie To Debian 9 Stretch

    debian linux

    Upgrading server on a remote location is not safe unless you have KVM access. I did many Debian 8 to Debian 9 upgrade on remote server with out probem. On one server, network card name chaned from eth0 to new enp4s0 format. I had to access the server using KVM and fix network configuration by editing /etc/network/interfaces

    First you need to upgrade all software on your server to latest Debian 8

    apt update && apt upgrade -y && apt dist-upgrade -y
    

    Now replace content of /etc/apt/sources.list file with following

    vi /etc/apt/sources.list
    

    Add

    deb http://cloudfront.debian.net/debian/ stretch main non-free contrib
    deb-src http://cloudfront.debian.net/debian/ stretch main non-free contrib
    
    deb http://security.debian.org/debian-security stretch/updates main contrib non-free
    deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free
    

    Update the software again with

    apt update && apt upgrade -y && apt dist-upgrade -y
    

    It can take some time for the upgrade to finish. Once update complete, you can check with lsb_release -a command, you will see

    debian upgrade

    Remove unused packages with command

    apt autoremove -y
    

    At this stage, server stil use old debian 8 kernal.

    root@v2m2:~# uname -r
    3.16.0-6-amd64
    root@v2m2:~# 
    

    To boot to new Debian 9 kernal, reboot the server with

    reboot
    

    After reboot, you will see new kernal.

    Now Debian 10 is available. See How to upgrade Debian 9 to Debian 10

  • Debian 8 jessie repo error

    On a Debian 8 server, when running apt update, got following error

    W: Failed to fetch http://mirror.com/debian/dists/jessie/main/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/non-free/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/contrib/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/main/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/non-free/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/contrib/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/main/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/non-free/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie/contrib/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/main/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/contrib/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/non-free/source/Sources  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/main/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/contrib/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/non-free/binary-amd64/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/main/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/contrib/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    W: Failed to fetch http://mirror.com/debian/dists/jessie-updates/non-free/binary-i386/Packages  404  Not Found [IP: 185.194.238.133 80]
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    

    To fix it, run

    cp /etc/apt/sources.list /etc/apt/sources.list.backup
    vi /etc/apt/sources.list
    

    Add following content to the file

    deb http://cdn-fastly.deb.debian.org/debian/ jessie main
    deb-src http://cdn-fastly.deb.debian.org/debian/ jessie main
    deb http://security.debian.org/ jessie/updates main
    deb-src http://security.debian.org/ jessie/updates main
    deb http://archive.debian.org/debian jessie-backports main
    deb-src http://archive.debian.org/debian jessie-backports main
    

    Create

    vi /etc/apt/apt.conf
    

    Add

    Acquire::Check-Valid-Until "false";
    
  • apt – Problem unlinking the file auxfiles

    When i get apt update on a Debian 9 server, i get following error

    # apt update
    Get:1 http://ftp.debian.org/debian stretch-updates InRelease [91.0 kB]
    Hit:2 http://security.debian.org stretch/updates InRelease                                                                          
    Hit:3 https://packages.sury.org/php stretch InRelease                              
    Ign:4 http://ftp.us.debian.org/debian stable InRelease                             
    Hit:5 http://ftp.us.debian.org/debian stable Release
    Fetched 91.0 kB in 0s (165 kB/s)
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    All packages are up to date.
    W: Problem unlinking the file auxfiles - Clean (21: Is a directory)
    # 
    

    The problem is fixed by deleting

    rm -rf /var/lib/apt/lists/
    
  • Install PowerShell in Debian 9

    To install Microsoft PowerShell in Debian 9, run

    apt-get update
    apt-get install curl gnupg apt-transport-https
    

    Install GPG keys

    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
    

    Add repository

    echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list
    

    Install powershell

    apt-get update && apt-get install -y powershell
    

    To start powershell, run

    pwsh
    
  • apt-key keyserver receive failed: No dirmngr

    When running apt-key command, i get following error.

    root@ip-172-31-46-9:~# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
    Executing: /tmp/apt-key-gpghome.MYmMoDt7Sv/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
    gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
    gpg: connecting dirmngr at '/run/user/0/gnupg/d.ar6ctd7ngpsiegqaseo7cgyr/S.dirmngr' failed: No such file or directory
    gpg: keyserver receive failed: No dirmngr
    root@ip-172-31-46-9:~# 

    To fix this, run

    apt install dirmngr
  • Install MongoDB 4 on Debian 9

    You can see detailed instruction on how to install on MongoDB web site.

    First add key

    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
    

    For Debian 8, run

    echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/4.0 main" > /etc/apt/sources.list.d/mongodb-org-4.0.list
    

    For Debian 9, run

    echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" > /etc/apt/sources.list.d/mongodb-org-4.0.list
    

    Now install mongoDB with

    apt-get update
    apt-get install -y mongodb-org
    

    Once installed, you can check version with

    root@ip-172-31-25-155:~# mongod --version
    db version v4.0.4
    git version: f288a3bdf201007f3693c58e140056adf8b04839
    OpenSSL version: OpenSSL 1.1.0f  25 May 2017
    allocator: tcmalloc
    modules: none
    build environment:
        distmod: debian92
        distarch: x86_64
        target_arch: x86_64
    root@ip-172-31-25-155:~# 
    

    Enable MongoDB start on boot

    systemctl enable mongod
    

    To start/stop mongodb

    systemctl start mongod
    systemctl stop mongod
    
  • Install OpenLiteSpeed on Ubuntu/Debian

    Install OpenLiteSpeed on Ubuntu/Debian

    OpenLiteSpeed ia an Open Source version of LiteSpeed Web Server.

    To install OpenLiteSpeed, add repository by running

    wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | bash
    

    Now you have openlitespeed packages available on your server. Here is packages available on a Debian 9 server.

    OpenLiteSpeed Web Server

    To install OpenLiteSpeed, run

    apt install -y openlitespeed
    

    OpenLiteSpeed will be installed in folder

    /usr/local/lsws
    

    You can start/stop OpenLiteSpeed using command

    root@ok:~# /usr/local/lsws/bin/lswsctrl
    $Usage: /usr/local/lsws/bin/lswsctrl {start|stop|restart|reload|condrestrt|try-restart|status|help}
    
    start       - start web server
    stop        - stop web server
    restart     - gracefully restart web server with zero down time
    reload      - same as restart
    condrestart - gracefully restart web server if server is running
    try-restart - same as condrestart
    status      - show service status
    help        - this screen
    
    root@ok:~#
    

    Once installed, you will be able to login to WebAdmin at

    https://YOUR_SERVER_IP_ADDR:7080
    User = admin
    Pass = 123456
    

    You can change default admin passord by going to

    Admin > WebAdmin Settings > General > Users

    Click on edit icon right side of user “admin”.

    OpenLiteSpeed Change Admin Password

    You can also change OpenLiteSpeed Admin password by running following command as user root

    /usr/local/lsws/admin/misc/admpass.sh