To set default editor in Ubuntu/Debian, run
update-alternatives --config editor
To set default editor in Ubuntu/Debian, run
update-alternatives --config editor
To install drivers on Ubuntu using command line, run
boby@sok-01:~$ sudo ubuntu-drivers devices == /sys/devices/pci0000:00/0000:00:01.1/0000:01:00.0 == modalias : pci:v000010DEd00001F82sv00001458sd00003FCBbc03sc00i00 vendor : NVIDIA Corporation driver : nvidia-driver-430 - distro non-free recommended driver : xserver-xorg-video-nouveau - distro free builtin boby@sok-01:~$
This list all drivers available for your hardware. You can install a driver with apt. In this cuase, i have 2 drivers available
driver : nvidia-driver-430 - distro non-free recommended driver : xserver-xorg-video-nouveau - distro free builtin
First driver is recommended by Ubuntu. To install, run
apt install nvidia-driver-430
Start software and updates application.
Click on Additional Drivers tab. You will see available drivers for your computer.
ShadowSocks client is part of shadowsocks package. This include both client and server. If you are looking to install server, see Install ShadowSocks server on Debian 10
To install ShadowSocks, run
apt install -y shadowsocks
ShadowSocks client is called sslocal, get installed in /usr/bin/sslocal.
On Ubuntu, no start up script provided with this package, so you need to create one or manually run sslocal when required.
Create a service file
vi /lib/systemd/system/[email protected]
Add following content
[Unit] Description=Shadowsocks client mode service Documentation=man:sslocal(1) After=network-online.target [Service] Type=simple User=nobody Group=nogroup ExecStart=/usr/bin/sslocal -q -c /etc/shadowsocks/%i.json Restart=on-failure RestartSec=30 [Install] WantedBy=multi-user.target
Now we need to create a configuration file with your ShadowSocks server IP and password.
mkdir /etc/shadowsocks/ vi /etc/shadowsocks/local.json
Add following content
{ "server":"YOUR_SERVER_IP", "server_port":8044, "local_address": "127.0.0.1", "local_port":8044, "password":"PASSWORD", "timeout":300, "method":"aes-256-cfb", "fast_open": false, "workers": 1, "prefer_ipv6": false }
“server” = IP of the server where you installled ShadowSocks server.
“server_port” = Port used by ShadowSocks server
“password” = ShadowSocks server password.
local_port can be anything you like.
Enable shadowsocks service
systemctl enable shadowsocks-local@local
To start
systemctl start shadowsocks-local@local
To see status
systemctl status shadowsocks-local@local
Now you can configure your browser or other sock proxy supported application using 127.0.0.1:8044. Here is how to configure firefox
To setup MineCraft server on Ubuntu, first you need to install Java.
apt install openjdk-8-jre -y
Create a user to run minecraft
useradd -m --shell /bin/bash minecraft
You can set a password if you want direct SSH login to this user or login as root, then “su – minecraft”.
passwd minecraft
Login as user minecraft with SSH or “su”.
Download minecraft server .jar file from
https://www.minecraft.net/en-us/download/server/
At the time of writing, i downloaded
wget https://launcher.mojang.com/v1/objects/3dc3d84a581f14691199cf6831b71ed1296a9fdf/server.jar
Don’t use above link as it can get older, always go to minecraft site and get new link, so you get latest minecraft server jar file.
You can start minecraft server with command
java -Xmx1024M -Xms1024M -jar server.jar nogui
First time when you run, it exit with some error related to EULA.
You need to edit file
vi eula.txt
Set
eula=true
Now minecraft will run. You can create a run.sh file with following command for starting minecrat easily.
vi ~/start.sh
Paste following content
#!/bin/bash java -Xmx1024M -Xms1024M -jar server.jar nogui
To make the file executable, chmod it 755
chmod 755 ~/start.sh
When you start minecraft from terminal/ssh, it get closed when you disconnect. To keep minecraft server running after you disconnect, use tmux or screen.
On Ubuntu 19.04, networking service is provided by package ifupdown
apt install -y ifupdown
By default this package is not installed. So if you add network interface configuration in /etc/network/interfaces, it won’t work.
Ubuntu 18.04 + use netplan instead of ifupdown/networking service to configure network interfaces.
Latest Ubuntu/Debian use systemd-resolved for DNS resolution. On a fresh Ubuntu 19.04 install DNS failed to resolve.
root@ubuntu19:/# ping serverok.in ping: serverok.in: Temporary failure in name resolution root@ubuntu19:/#
To fix this, create file
mkdir /etc/systemd/resolved.conf.d/ vi /etc/systemd/resolved.conf.d/dns_servers.conf
Add content
[Resolve] DNS=8.8.8.8 1.1.1.1
Restart systemd-resolved
systemctl restart systemd-resolved
You can find systemd-resolvd status with command
resolvectl status systemd-resolve --status
To resolve a domain, use
resolvectl query serverok.in
When you login to an Ubuntu server using SSH, you get welcome message like
On most Linux systems, this is generated by /etc/motd. On Ubuntu, MOTD (message of the day) generated dynamically with some scripts. I don’t want to see all the marketing message from Ubuntu everyday.
To disable MOTD on Ubuntu, just delete the scripts from /etc/update-motd.d/
rm -f /etc/update-motd.d/*
If you want a differnt motd, you can put a shell script in this folder.
Another way to disable motd is by disabling pam_motd.so module.
Edit files
/etc/pam.d/login /etc/pam.d/sshd
Comment out the lines related to pam_motd.so
session optional pam_motd.so motd=/run/motd.dynamic session optional pam_motd.so noupdate
Ubuntu 18.04 was released with Linux kernel 4.15
root@DUS-147022:~# hostnamectl Static hostname: DUS-147022.op-net.com Icon name: computer-desktop Chassis: desktop Machine ID: 1fcb383ac03e4299a3b994dca4c51a10 Boot ID: 66d616e9b11145c38387d71f9c48a4bd Operating System: Ubuntu 18.04.3 LTS Kernel: Linux 4.15.0-58-generic Architecture: x86-64 root@DUS-147022:~#
On 8 Aug 2019, Cannonical released Ubuntu 18.04.3 LTS with Linux Kernel 5.0.
If you are using older Ubuntu 18.04 point release, you won’t get newer kernel when you do software upgrade.
To get newer Linux kernal installed, you need to install Hardware enablement (HWE) stack, this provide newer kernel that provide support for latest hardware.
To install Hardware enablement (HWE) stack, run
apt install linux-generic-hwe-18.04
if this is Desktop computer, you may need to run
apt install linux-generic-hwe-18.04 xserver-xorg-hwe-18.04
after installing, reboot
reboot
after reboot, you will see latest Linux Kernel.
boby@sok-01:~$ hostnamectl Static hostname: sok-01 Icon name: computer-desktop Chassis: desktop Machine ID: 70486772aac1410c9a8031851ab60a0d Boot ID: 6c946c08f95d4c6b883e6790ab83e728 Operating System: Ubuntu 18.04.3 LTS Kernel: Linux 5.0.0-25-generic Architecture: x86-64 boby@sok-01:~$
When a normal user edit Wi-Fi connection on Wi-Fi Settings, they will be asked to enter administrator user pasword.
To allow a normal user to modify network connection, you can edit the connection configuration file in folder
/etc/NetworkManager/system-connections
This file look like
root@sok-01:/etc/NetworkManager/system-connections# cat SOK [connection] id=SOK uuid=982596a7-44c8-4e52-a696-6acf4daeec12 type=wifi permissions= [wifi] mac-address=E8:DE:27:0B:39:55 mac-address-blacklist= mode=infrastructure ssid=SOK [wifi-security] auth-alg=open key-mgmt=wpa-psk psk=Sup3rD0nkey [ipv4] dns-search= method=auto [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto root@sok-01:/etc/NetworkManager/system-connections#
Find
permissions=
Replace with
permissions=user:USER_NAME_HEARE:;
USER_NAME_HEARE = replace this with actual username, that need to edit the network configuration.
This script configure MariaDB repository on your server. You can find more details on offical page
https://mariadb.com/kb/en/library/mariadb-package-repository-setup-and-usage/
To setup mariadb repo, run
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
I was expecting it ask me what version of MariaDB i like to setup. But it just setup MariaDB 10.4. I wanted to upgrade MariaDB to version 10.2, anyway i did upgrade to 10.4 and everything worked fine.
If you need a speicfic version, you can run like
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.3"
Availabe versions are
mariadb-5.5 mariadb-10.0 mariadb-10.1 mariadb-10.2 mariadb-10.3 mariadb-10.4
When i run the script on Debian 9 server, i get following error
root@server:~# curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash [info] Repository file successfully written to /etc/apt/sources.list.d/mariadb.list [info] Adding trusted package signing keys... Executing: /tmp/apt-key-gpghome.TKjSzTY6ww/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x8167EE24 0xE3C94F49 0xcbcb082a1bb943db 0xF1656F24C74CD1D8 0x135659e928c12247 gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory gpg: connecting dirmngr at '/run/user/0/gnupg/d.3y8gtbm7kaj8h4royj6yoyug/S.dirmngr' failed: No such file or directory gpg: keyserver receive failed: No dirmngr [error] Failed to add trusted package signing keys. root@server:~#
This is fixed by running
apt -y install dirmngr
To enable remote desktop on Ubuntu 18.04 (works with newer Ubuntu versions), go to settings.
Click on Sharing
Click on ON/OFF button on title bar to enable Desktop Sharing. Once enabled, click on “Screen Sharing” to See Desktop sharing option, you need to enable it for network connection.
Ubuntu use vino package to allow remote desktop over VNC.
See Ubuntu, VNC, remote desktop
To install x11vnc on Debian/Ubuntu, run
apt install -y x11vnc
To start vnc server, run
x11vnc -display :0
By default, there will be no password. To set password, run
x11vnc -storepasswd
To start x11vnc server with password, run
x11vnc -rfbauth ~/.vnc/passwd