Skip to content

Instantly share code, notes, and snippets.

@khiemdoan
Last active November 14, 2023 09:50
Show Gist options
  • Save khiemdoan/d1a50c488139ba64afc5edd323087aac to your computer and use it in GitHub Desktop.
Save khiemdoan/d1a50c488139ba64afc5edd323087aac to your computer and use it in GitHub Desktop.
This note about software, config in my Ubuntu.

Ubuntu Setup

This note about software, config in my Ubuntu.

Change swap size

sudo swapoff -a
sudo fallocate -l 1G /swap.img
sudo chmod 600 /swap.img
sudo mkswap /swap.img
sudo swapon /swap.img

Check: free -m

Use apt

Install:

sudo apt install <package-name>
sudo apt insstall ./google-chrome-stable_current_amd64.deb

Purge:

sudo apt purge <package-name>

Autoremove:

sudo apt autoremove

Update:

sudo apt update -y
sudo apt upgrade -y
sudo apt dist-upgrade -y

dpkg

sudo dpkg -i google-chrome-stable_current_amd64.deb

Chrome

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt install -f

Synaptics driver

sudo apt install xserver-xorg-input-synaptics

Gnome Shell Extensions

sudo apt install gnome-shell-extensions

Git client

sudo apt install git

LSD (LSDeluxe) - The next gen ls command

apt install lsd

Neovim - hyperextensible Vim-based text editor

sudo apt install neovim

TLP - Linux Advanced Power Management

sudo add-apt-repository ppa:linrunner/tlp
sudo apt install tlp tlp-rdw

Check: sudo tlp-stat

Open JDK

sudo apt install openjdk-17-jdk

Go lang

sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt install golang-go

KVM - Kernel-based Virtual Machine

KVM

sudo apt install qemu-kvm libvirt-daemon-system virtinst libvirt-clients bridge-utils
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER

Logout

Make a Bridge Network for the VMs

Create netplan configuration file: /etc/netplan/01-netcfg.yaml

network:
  version: 2
  ethernets:
    eth0:
      dhcp4: false
      dhcp6: false
  bridges:
    br0:
      interfaces: [eth0]
      dhcp4: false
      addresses: [10.254.152.27/24]
      macaddress: 01:26:3b:4b:1d:43
      routes:
        - to: default
          via: 10.254.152.1
          metric: 100
      nameservers:
        addresses: [8.8.8.8]
      parameters:
        stp: false
      dhcp6: false

VirtManager

sudo apt install virt-manager

WebVirtMgr

Install WebVirtMgr

Switch KVM to Virtualbox

/sbin/rmmod kvm_intel
/sbin/rmmod kvm
/etc/init.d/vboxdrv start

Switch Virtualbox to KVM

/etc/init.d/vboxdrv stop
/sbin/insmod /lib/modules/`uname -r`/kernel/arch/x86/kvm/kvm.ko
/sbin/insmod /lib/modules/`uname -r`/kernel/arch/x86/kvm/kvm-intel.ko

Docker

for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

sudo usermod -a -G docker $USER
Restart computer.

# Setup firewall
sudo ufw allow from 172.0.0.0/8 to 172.17.0.1

Add cron: sudo crontab -e

@daily docker system prune --all --force
@reboot docker system prune --all --force

Edit /etc/docker/daemon.json

{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}

Cloudflare WARP

curl https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt update
sudo apt install cloudflare-warp
warp-cli register
warp-cli connect

For Debian-based

curl https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt update
sudo apt install cloudflare-warp
warp-cli register
warp-cli connect

Check

curl -s https://www.cloudflare.com/cdn-cgi/trace/ | grep warp

Remmina - Remote Desktop Client

sudo apt-add-repository ppa:remmina-ppa-team/remmina-next
sudo apt install remmina remmina-plugin-rdp libfreerdp-plugins-standard

7zip, rar

sudo apt install p7zip-full p7zip-rar

Chromium browser

sudo apt install chromium-browser

LibreOffice

sudo add-apt-repository ppa:libreoffice/ppa
sudo apt install libreoffice

SimpleScreenRecorder

sudo apt install simplescreenrecorder

GoldenDict - Dictionary

sudo apt install goldendict goldendict-wordnet

Fix Lost Wire Network

Open file /etc/NetworkManager/NetworkManager.conf

And add a line: managed=true

Wine

sudo dpkg --add-architecture i386
wget -O- https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
sudo apt install winehq-stable

Lastly run winecfg in the terminal to make sure it configures Wine correctly.

Install winetricks

sudo apt install winetricks

Kodi

sudo add-apt-repository ppa:team-xbmc/ppa
sudo apt install kodi

qBittorrent

sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable
sudo apt install qbittorrent

Caffeine

sudo add-apt-repository ppa:caffeine-developers/ppa
sudo apt install caffeine

WireGuard VPN

sudo apt install wireguard

Change swap size

sudo swapoff -a
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Edit /etc/fstab and add the new swapfile if it isn’t already there

/swapfile none swap sw 0 0

Check the amount of swap available

grep SwapTotal /proc/meminfo

Disable IPv6 systemwide

Open the /etc/sysctl.conf file and add the following to the bottom of the file:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Then type sudo sysctl -p to activate your changes

Build vmmon and vmnet

sudo vmware-modconfig --console --install-all
openssl req -new -x509 -newkey rsa:2048 -keyout VMWARE.priv -outform DER -out VMWARE.der -nodes -days 36500 -subj "/CN=VMWARE/"
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE.priv ./VMWARE15.der $(modinfo -n vmmon)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./VMWARE.priv ./VMWARE15.der $(modinfo -n vmnet)
tail $(modinfo -n vmmon) | grep "Module signature appended"
sudo mokutil --import VMWARE.der
Reboot
mokutil --test-key VMWARE15.der

Enable promiscuous mode - VM Ware

Step 1: Shut down the VMware guest machine

Step 2: At you host, enable the promiscuous mode

sudo chmod a+rw /dev/vmnet0

or

sudo chmod 666 /dev/vmnet*

Reference: https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=287

Auto mount partition

ls -la /dev/disk/by-uuid/

lấy uuid của ổ đĩa, copy vào file /etc/fstab

vi du:

lrwxrwxrwx 1 root root 10 Th05 20 15:01 01CE66839C56B480 -> ../../sdb7
lrwxrwxrwx 1 root root 10 Th05 20 15:01 01D156D38069CA80 -> ../../sda6
lrwxrwxrwx 1 root root 10 Th05 20 15:01 01D1A8D1FE953E80 -> ../../sdb6
lrwxrwxrwx 1 root root 10 Th05 20 15:01 741A807E1A803EDC -> ../../sdb8
lrwxrwxrwx 1 root root 10 Th05 20 15:01 a71f0696-9d2b-41e6-b391-cb340b8f724d -> ../../sdb5
lrwxrwxrwx 1 root root 10 Th05 20 15:01 E04448E44448BED2 -> ../../sda1
lrwxrwxrwx 1 root root 10 Th05 20 15:01 f4bec8ae-68bf-404c-a6a2-846f08791117 -> ../../sda7

sửa file /etc/fstab

UUID=a71f0696-9d2b-41e6-b391-cb340b8f724d /data ext4 defaults 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment