Skip to content

Instantly share code, notes, and snippets.

@namndev
Last active June 22, 2023 12:29
Show Gist options
  • Save namndev/ca5d8afae80454d291b76ab0a204918a to your computer and use it in GitHub Desktop.
Save namndev/ca5d8afae80454d291b76ab0a204918a to your computer and use it in GitHub Desktop.
Things to do After Installing Ubuntu

Things to do After Installing Ubuntu

Some package for dev

sudo add-apt-repository ppa:bamboo-engine/ibus-bamboo
sudo apt update
sudo apt install vim git zsh build-essential heif-gdk-pixbuf ibus ibus-bamboo gdebi
im-config -n ibus

Install media codecs

$ sudo apt install ubuntu-restricted-extras

Install GNOME Tweak

$ sudo apt install gnome-tweaks

ZSH for terminal

$ sudo usermod -s /usr/bin/zsh $(whoami)
$ sudo reboot

To install Oh-My-ZSH

$ sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

OR Install Prezto

Install font & Syntax Highlighting extension

$ sudo apt-get install powerline fonts-powerline
$ git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

Append zsh-autosuggestions & zsh-syntax-highlighting to plugins() like this

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

Install Theme Powerlevel10k

$ git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

Then edit your ~/.zshrc and set ZSH_THEME="powerlevel10k/powerlevel10k". Also add the following: POWERLEVEL9K_MODE="awesome-patched"

Display only the last directory segment

  • Open ~/.p10k.zsh, search for POWERLEVEL9K_SHORTEN_STRATEGY and change the value of this parameter to truncate_to_last

  • Alternatively, you can try changing the value of POWERLEVEL9K_DIR_MAX_LENGTH to 1.

  • If you frequently work outside of your home directory, you might want to utilize named directories. For example, WSL users often add this to their ~/.zshrc:

Install a patched font

Enabling Oh-My-ZSH Plugins:

Oh-My-ZSH has many plugins. You can find a list of pre-installed plugins at https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins

Let’s install the colored-man-pages plugin. It adds color to the Linux man pages.

Visual Studio Code config

Installing a patched font will mess up the integrated terminal in VS Code unless you use the proper settings. You'll need to go to settings (Ctrl + ,) and add or edit the following values:

  • For Source Code Pro + Font Awesome: "terminal.integrated.fontFamily": "'SourceCodePro+Powerline+Awesome Regular'". The single quotes are important! Restart VS Code after the config change.
  • For Source Code Pro: "terminal.integrated.fontFamily": "Source Code Pro for Powerline"
  • For Meslo: "terminal.integrated.fontFamily": "Meslo LG M for Powerline"

You can also set the fontsize e.g.: "terminal.integrated.fontSize": 14

Manual install JavaSDK

Download file jdk-8u241-linux-x64.tar.gz at this storage

$ sudo mkdir /opt/java-jdk
$ sudo tar -C /opt/java-jdk -zxf ~/jdk-8u241-linux-x64.tar.gz

Set Default

$ sudo update-alternatives --install /usr/bin/java java /opt/java-jdk/jdk1.8.0_241/bin/java 1
$ sudo update-alternatives --install /usr/bin/javac javac /opt/java-jdk/jdk1.8.0_241/bin/javac 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /opt/java-jdk/jdk1.8.0_241/bin/javaws 1

Check

$ sudo update-alternatives --config java

Install Maven

$ sudo apt install maven

GEN SSH KEY

ssh-keygen -t ed25519 -C "email"

Config for many sshkey

vi ~/.ssh/config

with content

Host *.domain.*
IdentityFile ~/.ssh/domain_rsa

Host *.domain2.*, 10.x.x.*
IdentityFile ~/.ssh/domain2_rsa

example:

eval "$(ssh-agent -s)"

Host *
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519
Host *.teko.vn
  AddKeysToAgent yes
  IdentityFile ~/.ssh/nam_teko

Eclipse Shortcut for Ubuntu

cd ~/.local/share/applications
wget https://gist.github.com/raw/2922285/eclipse.desktop
chmod u+x eclipse.desktop
vi eclipse.desktop

Install MySQL Server

$ sudo apt install mysql-server
$ sudo mysql_secure_installation
$ sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

And then change the bind-address line to 0.0.0.0 instead of 127.0.0.1.

$ sudo systemctl restart mysql
$ sudo systemctl enable mysql

By default, MySQL listens for connections on port 3306. You can confirm that your MySQL service is listening for incoming connections on all interfaces 0.0.0.0 with this command:

$ ss -ltn

Finally, the only thing left to do is make sure that your server's firewall isn't blocking incoming connections on port 3306 (default MySQL listening port). You can issue the following ufw command to add an exception in Ubuntu's default firewall:

$ sudo ufw allow from any to any port 3306 proto tcp

Set password for Root

$ sudo mysql

Next, check which authentication method each of your MySQL user accounts use with the following command:

mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
Output
+------------------+-------------------------------------------+-----------------------+-----------+
| user             | authentication_string                     | plugin                | host      |
+------------------+-------------------------------------------+-----------------------+-----------+
| root             |                                           | auth_socket           | localhost |
| mysql.session    | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| mysql.sys        | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| debian-sys-maint | *CC744277A401A7D25BE1CA89AFF17BF607F876FF | mysql_native_password | localhost |
+------------------+-------------------------------------------+-----------------------+-----------+
4 rows in set (0.00 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

If failed:

msyql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password.check_user_name    | ON    |
| validate_password.dictionary_file    |       |
| validate_password.length             | 8     |
| validate_password.mixed_case_count   | 1     |
| validate_password.number_count       | 1     |
| validate_password.policy             | MEDIUM|
| validate_password.special_char_count | 1     |
+--------------------------------------+-------+
mysql> SET GLOBAL validate_password.length = 6;
mysql> SET GLOBAL validate_password.policy = LOW;
mysql> SET GLOBAL validate_password.number_count = 0;

Finally

mysql> FLUSH PRIVILEGES;

POSTGRESQL

sudo apt install postgresql postgresql-contrib

Check port

ss -nlt

To bind address 0.0.0.0

sudo systemctl disable postgresql
sudo vi /etc/postgresql/12/main/postgresql.conf

Find and edit:

listen_addresses = '*' // before is local

and

sudo systemctl restart postgresql
sudo bash -c "echo host    all          all            0.0.0.0/0  md5 >> /etc/postgresql/12/main/pg_hba.conf"
sudo ufw allow from any to any port 5432 proto tcp
sudo -u postgres psql
\password

Auto start postgresql when boot

sudo update-rc.d postgresql enable

Android Devices With ADB

Check device vendor id and product id:

$ lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 078: ID 138a:0011 Validity Sensors, Inc. VFS5011 Fingerprint Reader
Bus 002 Device 003: ID 8087:07dc Intel Corp. 
Bus 002 Device 002: ID 5986:0652 Acer, Inc 
Bus 002 Device 081: ID 22b8:2e81 Motorola PCS 
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Here my android device is Motorola PCS. So my vid=22b8 and pid=2e81.

Now create a udev rule:

sudo vi /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="2e81", MODE="0666", GROUP="plugdev"

Now the device is good to be detected once udev rule is reloaded. So, let's do it:

$ sudo udevadm control --reload-rules

Fix Pulse Secure in Ubuntu 20.04

https://community.pulsesecure.net/t5/Pulse-Desktop-Clients/pulseUi-doesn-t-work-in-ubuntu-20-04/m-p/42733#M1572

GO

Download from Go for Linux

sudo tar -C /usr/local -xzf go1.15.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin

Python

In ubuntu 20.04 using python 3.8 To set default:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1

install pip3

 sudo apt install python3-pip
 pip3 --version

MS Fonts

sudo apt install ttf-mscorefonts-installer
sudo fc-cache -f -v

Ibus bamboo FEDORA https://software.opensuse.org//download.html?project=home%3Alamlng&package=ibus-bamboo

@namndev
Copy link
Author

namndev commented May 6, 2023

Change the default terminal
sudo update-alternatives --config x-terminal-emulator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment