Ubuntu Tips

1 Show all network interfaces


$ ifconfig -a

$ lshw -C network

$ ip a s

# ip link set dev eno1 up   # enable network device eno1

# ip link set dev eno1 down # disable network device eno1

2 Remove ppa and trusted key

  1. remove file from /etc/apt/sources.list.d or use ‘ppa-purge’

  2. clean up trusted keys

    ;; list the trusted keys
    $ sudo apt-key list
    
    ;; remove the key
    $ sudo apt-key del KEY_ID
    

3 Upgrade kernel

https://askubuntu.com/a/926337

  1. find existing kernel

    $ uname -r
    
  2. find new kernel

    $ apt-cache search linux-image
    
  3. Install new kernel

    $ sudo apt-get install linux-image-4.13.0-21-generic linux-image-extra-4.13.0-21-generic linux-headers-4.13.0-21-generic
    
  4. Reboot using new kernel, confirm new kernel is installed

    $ uname -r
    
  5. Remove old kernel if everything works well.

    $ sudo apt-get autoremove
    

4 apt Install oracle jdk with 404 error

Since Oracle has moved the download link and requires login credentials to download older versions of java, follow the following steps to install java 7:

  1. Download latest java version from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html. You will need to login.

  2. Delete jdk-7uXX-linux-x64.tar.gz from var/cache/oracle-jdk7-installer where XX is the version number.

  3. Move the downloaded version into var/cache/oracle-jdk7-installer using the following command

    $ sudo mv jdk-7u(downloadedversion)-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/
    
  4. Now run the following command

    $ sudo apt-get install oracle-java7-installer
    

5 Manual install CryFS (Ubuntu)

# Add apt key
wget -O - https://www.cryfs.org/apt.key | sudo apt-key add -

# Add apt repository
sudo sh -c "echo \"deb http://apt.cryfs.org/ubuntu `lsb_release -s -c` main\" > /etc/apt/sources.list.d/cryfs.list"

# Install cryfs
sudo apt-get update
sudo apt-get install cryfs

6 vsftpd

  1. install vsftpd

    $ sudo apt update
    $ sudo apt install vsftpd
    

    backup configuration

    $ sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig
    
  2. Opening the Firewall

    $ sudo ufw status
    
    # open ports 20 and 21 for FTP, port 990 for later when we enable
    # TLS, and ports 40000-50000 for the range of passive ports we plan
    # to set in the configuration file:
    $ sudo ufw allow 20/tcp
    $ sudo ufw allow 21/tcp
    $ sudo ufw allow 990/tcp
    $ sudo ufw allow 40000:50000/tcp
    $ sudo ufw status
    
  3. Preparing the User Directory

    sudo adduser ftpuser --home /tank/sharing/ftpuser --shell /bin/false
    
  4. Add /bin/false to /etc/shells for allowing user login through ftp

  5. Change /etc/vsftpd.conf

    anonymous_enable=NO

    local_enable=YES

    write_enable=YES

    chroot_local_user=YES

    local_umask=012

    pasv_min_port=40000 pasv_max_port=50000

    userlist_enable=YES userlist_file=/etc/vsftpd.userlist userlist_deny=NO

    $ echo "sammy" | sudo tee -a /etc/vsftpd.userlist
    $ sudo systemctl restart vsftpd
    $ add user to group
    
    $ usermod -a -G ftpuser ubuntu
    

7 Dell Aurora Ethernet network

  1. Enable network card

    $ lspci -knn | grep -i eth
    $ modprobe alx
    $ echo '1969 e0b1' | sudo tee /sys/bus/pci/drivers/alx/new_id
    $ dmesg | grep -i eth0
    
  2. Setup network

    # DHCP
    $ sudo ip link set dev eth0 down
    $ sudo dhclient eth0
    
    # Static ip
    $ sudo ip addr add 192.168.1.14/24 dev eth0
    $ sudo ip link set dev eth0 up
    $ sudo ip route add default via 192.168.1.1
    
  3. If everything works, we need update configuration for future

    sudo vi /etc/network/interfaces
    
    ## To configure a dynamic IP address
    auto eth0
    iface eth0 inet dhcp
    
    ## Or configure a static IP
    auto eth0
    iface eth0 inet static
      address 192.168.1.14
      gateway 192.168.1.1
      netmask 255.255.255.0
      network 192.168.1.0
      broadcast 192.168.1.255
    
  4. For these settings to take effect you need to restart your networking services.

    $ sudo /etc/init.d/networking restart
    

8 Install Nvidia driver

  1. blacklist other driver, by editing file /etc/modprobe.d/nvidia-installer-disable-nouveau.conf

    blacklist amd76x_edac

    blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv

  2. Remove all old nvidia* packages

    $ sudo apt-get remove --purge nvidia-*
    
  3. Optional: Note: If you still get the error related to nouveau drivers then you are probably required to update the initramfs, which might be configured to load the nouveau drivers. Don’t reboot or poweroff, run this command to update the initramfs disk.

    $ sudo update-initramfs -u
    
  4. Install dependencies

    sudo apt install build-essential gcc-multilib dkms linux-headers-$(uname -r)
    

9 Install KVM

$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

or

$ sudo apt-get install qemu-kvm virtinst bridge-utils cpu-checker libvirt-clients

$ sudo usermod -a -G libvirt $(whoami) # add current user to libvirt group, so no need to sudo

10 Enable upnp for dlna

$ ufw allow 1900:1901/udp


© 2015-2020 tendant