Skip to content

Instantly share code, notes, and snippets.

View codedeep79's full-sized avatar

Nguyễn Trung Hậu codedeep79

View GitHub Profile
@codedeep79
codedeep79 / Cài đặt Go trên Ubuntu.md
Last active August 3, 2022 08:06
Cài đặt Go trên Ubuntu

Install Go

sudo apt update
sudo apt install golang

Verify the installation to display the installed Go version on the terminal by running the following command: go version

Create test program using Go

First, create a new directory for the test program by running the below-mentioned command: mkdir goprogram

@codedeep79
codedeep79 / Download is performed unsandboxed as root as file.md
Created July 29, 2022 08:49
Download is performed unsandboxed as root as file '/home/ubuntu/tmp/packages-microsoft-prod.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

Make sure /home/ubuntu/tmp/ and everything below it are writeable for _apt, e.g. By running:

sudo chown -Rv _apt:root /home/ubuntu/tmp/
sudo chmod -Rv 700 /home/ubuntu/tmp/

@codedeep79
codedeep79 / How to enable and disable Universe, Multiverse and Restricted repository on Ubuntu 20.04 LTS Focal Fossa.md
Created July 29, 2022 12:36
How to enable/disable Universe, Multiverse and Restricted repository on Ubuntu 20.04 LTS Focal Fossa

Step 1: The easiest way to enable Ubuntu Universe, Multiverse and Restricted repositories is to use the add-apt-repository command. The following commands will enable all repositories: sudo add-apt-repository universe multiverse restricted

Reboot your system: sudo reboot

Check again: Tick all repository

Step 2: Check for enabled repositories: grep ^deb /etc/apt/sources.list

@codedeep79
codedeep79 / Cài đặt Python Django trong Ubuntu 22.04.md
Last active August 3, 2022 08:06
Cài đặt Python Django trong Ubuntu 22.04

Installing Python 3

Django doesn’t support Python 2 anymore that is why we need to install python 3 in our system: sudo apt install python3.10.0

Sample output:

....
The following additional packages will be installed:
  bzip2 libpython3.10-minimal libpython3.10-stdlib mailcap mime-support python3.10-minimal
Suggested packages:
 bzip2-doc python3.10-venv python3.10-doc binfmt-support
@codedeep79
codedeep79 / How to kill a process on a port on Ubuntu.md
Created July 30, 2022 04:00
How to kill a process on a port on Ubuntu

To kill a process running on Port number 8000:

sudo kill -9 $(sudo lsof -t -i:8000)


lsof   - list of files(Also used for to list related processes)

-t     - show only process ID

-i - show only internet connections related process
@codedeep79
codedeep79 / Install and Use Flask on Ubuntu 22.04.md
Created July 30, 2022 04:33
Install and Use Flask on Ubuntu 22.04

Installing Python 3

Install python 3 in our system: sudo apt install python3.10.0

Sample output:

....
The following additional packages will be installed:
  bzip2 libpython3.10-minimal libpython3.10-stdlib mailcap mime-support python3.10-minimal
Suggested packages:
 bzip2-doc python3.10-venv python3.10-doc binfmt-support
@codedeep79
codedeep79 / Command 'python' not found.md
Created July 30, 2022 05:02
Lỗi: Command 'python' not found

Error:

if you do this: $ python

it will say Command 'python' not found ...

But if you do this: $ python3, it should work.

Open terminal and run: sudo apt install python-is-python3

@codedeep79
codedeep79 / How to check if MySQL server is working or not.md
Last active July 31, 2022 07:45
How to check if MySQL server is working or not?

Many ways to do it - in your terminal: sudo service mysql status or ps aux | grep mysql

@codedeep79
codedeep79 / Cài đặt WordPress trên Ubuntu 22.04 với LAMP Stack.md
Last active August 3, 2022 08:05
Cài đặt WordPress trên Ubuntu 22.04 với LAMP Stack

Prerequisites

Step 1 — Creating a MySQL Database and User for WordPress

To get started, log into the MySQL root (administrative) account by issuing the following command: sudo mysql -u root -p Within the database, create a dedicated database for WordPress to control. You can call this whatever you would like, but we will be using the name wordpress in this guide. Create the database for WordPress by running the following command:

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

@codedeep79
codedeep79 / How to check where Apache is running or listening on Localhost.md
Created July 31, 2022 08:47
How to check where Apache is running or listening on Localhost

In case you want to be perfectly sure:

  • lsof -i will list open ports and the corresponding applications. lsof | grep apache for apache. Similar: sudo netstat -anp | grep apache.
  • See /etc/hosts for IP addresses connected to names.
  • See /etc/apache2/sites-enabled/ for settings about the sites that are active for Apache.
  • See /etc/apache2/ports.conf for the Listen. It will have a port-number behind it. That parameter can also be in /etc/apache2/sites-enabled/