Tag: debian

  • How to Upgrade Debian 10 to Debian 11

    How to Upgrade Debian 10 to Debian 11

    One of the advantages of the Debian operating system is easy to upgrade to the newer version.

    Login to your Debian 10 server using SSH or console. Install all available software updates with the command

    apt update && apt upgrade -y

    Remove any unused packages

    apt autoremove

    Change /etc/apt/sources.list

    Make a backup of the file

    cp /etc/apt/sources.list ~/

    Edit the file /etc/apt/sources.list

    In the file, change all “buster” entries to “bullseye”. You can do this manually or using sed command

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

    Update System

    Update repository cache with

    apt update

    Upgrade software with

    apt upgrade

    Do a full-upgrade with

    apt full-upgrade

    Now reboot system

    reboot

    After reboot, you need to make sure all services running properly, there is a chance some services won’t work as expected, in that case, you need to debug and fix i.

    See Debian

  • How to install NVIDIA CUDA on Debian 10

    How to install NVIDIA CUDA on Debian 10

    CUDA® is a parallel computing platform and programming model developed by NVIDIA for general computing on graphical processing units (GPUs). With CUDA, developers are able to dramatically speed up computing applications by harnessing the power of GPUs.

    We will install NVIDIA CUDA on a Debian 10 server. Run the following commands as user root. If you are logged in with sudo user, you can run the command “sudo su” to become user root.

    Add NVIDIA repository

    apt install software-properties-common -y
    add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/debian10/x86_64/ /"
    apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/debian10/x86_64/7fa2af80.pub
    

    Enable the contrib repository

    add-apt-repository contrib
    

    Update the apt cache

    apt-get --allow-releaseinfo-change update
    

    Install cuda

    apt-get -y install cuda
    

    To find Nvidia driver version, you can run the command cat /proc/driver/nvidia/version

    root@sok-1:~# cat /proc/driver/nvidia/version
    NVRM version: NVIDIA UNIX x86_64 Kernel Module  470.103.01  Thu Jan  6 12:10:04 UTC 2022
    GCC version:  gcc version 8.3.0 (Debian 8.3.0-6) 
    root@sok-1:~#
    

    cuda installed in folder /usr/local/cuda-11.4/bin/, to find version, run

    root@sok-1:~# /usr/local/cuda-11.4/bin/nvcc -V
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2021 NVIDIA Corporation
    Built on Mon_Oct_11_21:27:02_PDT_2021
    Cuda compilation tools, release 11.4, V11.4.152
    Build cuda_11.4.r11.4/compiler.30521435_0
    root@sok-1:~# 
    

    Add the folder to PATH, edit the file

    vi ~/.bashrc
    

    Add following

    if [ -d "/usr/local/cuda-11.4/bin/" ]; then
        export PATH=/usr/local/cuda-11.4/bin${PATH:+:${PATH}}
        export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    fi
    

    Save and exit the file. Reload .bashrc with

    source ~/.bashrc
    

    You can find more info on NVIDIA driver with the command

    nvidia-smi
    

    NVIDIA CUDA command line

  • Debian 11.0 Bullseye released

    Debian 11.0 Bullseye released

    Debian 11.0 Bullseye released on August 14th, 2021 is the next major Debian GNU/Linux distribution release. Debian 10 buster is designated as oldstable.

    Debian 11.0 Bullseye

    https://www.debian.org/releases/bullseye/

    Debian 12 “Bookworm” is the new testing distribution with is expected to be released in 2023.

    You can download the latest version of Debian 11.0 ISO from

    https://www.debian.org/download

    What is new in Debian 11.0

    Debian 11.0 is powered by Linux 5.10 LTS kernel. It supports exFAT file system. Control groups v2 support. Improved support for alternative init systems.

    The new release of Debian 11.0 comes with a lot more software packages. It includes 11294 new packages. Most software on the distribution has been updated.

    You can find the list of software packages and versions at

    https://www.debian.org/releases/stable/amd64/release-notes/ch-whats-new.en.html#major-packages

    Upgrade Debian 10 to Debian 11.0

    You can find instructions for upgrading Debian 10 to Debian 11.0 at

    https://www.debian.org/releases/stable/amd64/release-notes/ch-upgrading.en.html

    See Debian

  • bash: locale-gen: command not found

    bash: locale-gen: command not found

    When I run locale-gen command, i get the following error

    root@netmon1:~# locale-gen en_US.UTF-8
    bash: locale-gen: command not found
    root@netmon1:~# 
    

    To see which package provide the locale-gen command, run

    boby@sok-01:~$ dpkg -S /usr/sbin/locale-gen
    locales: /usr/sbin/locale-gen
    boby@sok-01:~$ 
    

    The command locale-gen is provided by package locales. To fix the error install package “locales” with the command

    apt install -y locales
    

    See locale-gen

  • Reinstall Kernel in Ubuntu/Debian

    Reinstall Kernel in Ubuntu/Debian

    To reinstall Kernel in Ubunru, you need to find the version of kernal installed, for this run

    dpkg -l | grep linux-image
    

    Or you can use command, find the kernel version you need to install

    apt-cache search linux-image
    

    Once you have the name of linux-image package you need to install, you can run

    apt-get install --reinstall PKG_NAME_HERE
    

    Example

    reinstall ubuntu kernel

    See apt, Ubuntu, Debian

  • bash: man: command not found

    When running man command on a debian server, i get error

    root@lab:~# man sftp
    -bash: man: command not found
    root@lab:~#
    

    This is because man-db package not installed on the server. To fix, install man-db package with

    apt install man-db
    

    See Errors

  • Enable FTP for EasyEngine Website

    To Enable FTP for EasyEngine web sites, we need to install pure-ftpd. On Ubuntu/Debian, run

    apt install -y pure-ftpd
    

    Enable virtial FTP users

    ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/PureDB
    touch /etc/pure-ftpd/pureftpd.pdb
    

    In EasyEngine, we sites files are owned by www-data user, this user have a UID of 33. By default pure-ftpd won’t allow this. To enable users with UD 33 to login, run

    echo 1 > /etc/pure-ftpd/conf/MinUID
    

    Now lets create FTP user for a web site running in EasyEngine.

    pure-pw useradd  FTP_USER_HERE -u www-data -g www-data -d /opt/easyengine/sites/DOMAIN_NAME_HERE/app/
    

    In above command replace

    FTP_USER_HERE = FTP user for the web site, this can be any name, no space

    DOMAIN_NAME_HERE = the domain name of the web site that is hosted in EasyEngine, that you need FTP access.

    When you run above command, you will be asked to select password for the FTP user, this can be used to login to FTP server.

    Before you can login to FTP server with newly created virtual FTP user, you need to run

    pure-pw mkdb
    systemctl restart pure-ftpd
    

    Change FTP Password

    If you want to change FTP user for a user, you can run

    pure-pw passwd FTP_USER_HERE
    pure-pw mkdb
    systemctl restart pure-ftpd
    

    Passive FTP Configuration

    Many cloud hosting providers like AWS, Google Cloud, Oracle Cloud, AliCloud servers use NAT networking. That is your VM have private IP and your public IP is routed to your VM. In such case, you need to enable Passive FTP, for this run

    echo "30000 50000" > /etc/pure-ftpd/conf/PassivePortRange
    echo "YOUR_PUBLIC_IP" > /etc/pure-ftpd/conf/ForcePassiveIP
    

    YOUR_PUBLIC_IP = replace this with your public IP address.

    Restart pure-ftpd

    systemctl restart pure-ftpd
    

    Firewall configuration

    For Passive FTP, you need to open following ports in your firewall

    tcp 21
    tcp 30000:50000
    

    On Oracle Cloud server, i edited file

    vi /etc/iptables/rules.v4
    

    Find

    -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
    

    Replace with

    -A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 30000:50000 -j ACCEPT
    

    Now restore firewall rules with

    iptables-restore < /etc/iptables/rules.v4
    

    Now FTP will work.

    See EasyEngine

  • Uninstalling Software in Debian Server

    To uninstall a software on Debian server, run

    apt remove PKG_NAME
    

    Example

    uninstall software on debian server

    To all installed software with specific name, run

    dpkg-query -l PKG_NAME
    

    Example

    root@lab:~# dpkg-query -l 'nginx*'
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name           Version          Architecture Description
    +++-==============-================-============-=========================================================
    ii  nginx          1.14.2-2+deb10u3 all          small, powerful, scalable web/proxy server
    ii  nginx-common   1.14.2-2+deb10u3 all          small, powerful, scalable web/proxy server - common files
    un  nginx-doc                        (no description available)
    un  nginx-extras                     (no description available)
    ii  nginx-full     1.14.2-2+deb10u3 amd64        nginx web/proxy server (standard version)
    un  nginx-light                      (no description available)
    root@lab:~# 
    

    In above list, packages start with

    ii = installed
    un = currently not installed on the server

    When you uninstall a package, it won’t remove all config files, such packages list as uninsalled (un). To completely delete a package, its config file and data, use

    apt remove --purge PKG_NAME
    

    Example

    apt remove --purge apache2
    

    After removing a software package, you may need to run apt autoremove to remove any unused dependency.

    apt autoremove
    

    See apt

  • apt-cache

    To search for available packages, run

    apt-cache search PKG_NAME
    

    Example

    boby@sok-01:~$ apt-cache search wget
    devscripts - scripts to make the life of a Debian Package maintainer easier
    wget - retrieves files from the web
    abcde - A Better CD Encoder
    apt-mirror - APT sources mirroring tool
    axel - light command line download accelerator
    filetea - Web-based file sharing system
    getdata - management of external databases
    libcupt4-2-downloadmethod-wget - flexible package manager -- wget download method
    libwget0 - Download library for files and recursive websites
    ow-shell - shell utilities to talk to an 1-Wire owserver
    puf - Parallel URL fetcher
    pwget - downloader utility which resembles wget (implemented in Perl)
    python-wget - pure Python download utility for Python 2
    python3-wget - pure Python download utility for Python 3
    snarf - command-line URL grabber
    tcllib - Standard Tcl Library
    texlive-latex-extra - TeX Live: LaTeX additional packages
    wget2 - file and recursive website downloader
    wget2-dev - development file for libwget2
    wput - tiny wget-like ftp-client for uploading files
    boby@sok-01:~$ 
    

    Ubuntu find Dependencies for a package
    apt

  • Auto upgrade software in Ubuntu/Debian

    To auto upgrade software packages in Ubuntu/Debian, install

    apt install -y unattended-upgrades
    

    Edit

    vi /etc/apt/apt.conf.d/50unattended-upgrades
    

    In this file, you can configure various settings.

    See apt

  • apt The method driver /usr/lib/apt/methods/https could not be found

    When running apt update on a Debian server, i get error

    root@shop:~# apt-get update
    E: The method driver /usr/lib/apt/methods/https could not be found.
    N: Is the package apt-transport-https installed?
    root@shop:~# 
    

    apt https error

    To fix the error, run

    apt-get install apt-transport-https ca-certificates
    

    See apt