ติดตั้ง MySql บน Ubuntu 18.04

1.Installing MySQL

$ sudo apt update
$ sudo apt install mysql-server

2.Configuring MySQL

$ sudo mysql_secure_installation

3.Adjusting User Authentication and Privileges

$ mysql -u root -p
mysql> GRANT ALL ON *.* TO 'sammy'@'localhost' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;

4.Testing MySQL

$ systemctl status mysql.service
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-02-06 15:32:25 +07; 17min ago
 Main PID: 3831 (mysqld)
    Tasks: 28 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─3831 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid

ถ้า mysql ไม่ start ให้ start ด้วย

$ sudo systemctl start mysql 

ดูเวอร์ชันของ mysqladmin

$ sudo mysqladmin -p -u root version
Enter password: 
mysqladmin  Ver 8.42 Distrib 5.7.29, for Linux on x86_64
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version		5.7.29-0ubuntu0.18.04.1
Protocol version	10
Connection		Localhost via UNIX socket
UNIX socket		/var/run/mysqld/mysqld.sock
Uptime:			18 min 31 sec

Threads: 1  Questions: 21  Slow queries: 0  Opens: 113  Flush tables: 1  Open tables: 106  Queries per second avg: 0.018

ติดตั้ง Nginx บน Ubuntu 18.04

1.Installing Nginx

$ sudo apt update
$ sudo apt install nginx

2.Adjusting the Firewall

$ sudo ufw app list
Available applications:
  CUPS
  Nginx Full
  Nginx HTTP
  Nginx HTTPS
  • Nginx Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
  • Nginx HTTP: This profile opens only port 80 (normal, unencrypted web traffic)
  • Nginx HTTPS: This profile opens only port 443 (TLS/SSL encrypted traffic)
$ sudo ufw allow 'Nginx Full'
$ sudo ufw allow 'Nginx HTTP'
$ sudo ufw status
Status: inactive
$ sudo ufw enable
$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Nginx Full                 ALLOW       Anywhere
Nginx HTTP                 ALLOW       Anywhere
Nginx Full (v6)            ALLOW       Anywhere (v6)
Nginx HTTP (v6)            ALLOW       Anywhere (v6)

เปิดพอร์ทแบบกำหนดไปเลย

$ sudo ufw allow 22/tcp
$ sudo ufw allow 80/tcp
$ sudo ufw allow 443/tcp

3.Checking your Web Server

$ systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-02-06 14:26:15 +07; 33min ago
     Docs: man:nginx(8)
 Main PID: 5720 (nginx)
    Tasks: 5 (limit: 4915)
   CGroup: /system.slice/nginx.service
           ├─5720 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           ├─5721 nginx: worker process
           ├─5722 nginx: worker process
           ├─5723 nginx: worker process
           └─5724 nginx: worker process

Fixed phpMyAdmin ใน Ubuntu 18.04 “Warning in ./libraries/plugin_interface.lib.php#551 count()”

ปัญหา

Warning in ./libraries/plugin_interface.lib.php#551
 count(): Parameter must be an array or an object that implements Countable

วิธีแก้

backup ไฟล์ plugin_interface.lib.php ไว้ก่อน

$ sudo cp /usr/share/phpmyadmin/libraries/plugin_interface.lib.php /usr/share/phpmyadmin/libraries/plugin_interface.lib.php.bak

เข้าไปแก้ไขไฟล์ plugin_interface.lib.php

$ sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php 

กด CTRL + W แล้วค้นหาคำว่า

if ($options != null && count($options) > 0) {

ให้แทนด้วย

if ($options != null && count((array)$options) > 0) {

Link

Fixed phpMyAdmin ใน Ubuntu 18.04 “Warning in ./libraries/sql.lib.php#613 count()”

ปัญหา

Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable

วิธีแก้

backup ไฟล์ sql.lib.php ไว้ก่อน

$ sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak

เข้าไปแก้ไขไฟล์ sql.lib.php

$ sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php

กด CTRL + W แล้วค้นหาคำว่า

(count($analyzed_sql_results['select_expr'] == 1)

ให้แทนด้วย

((count($analyzed_sql_results['select_expr']) == 1

Link

Install .NET Core SDK on Linux Ubuntu 18.04 – x64

Register Microsoft key and feed

Before installing .NET, you’ll need to register the Microsoft key, register the product repository, and install required dependencies. This only needs to be done once per machine.

$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb

Install the .NET SDK

Update the products available for installation, then install the .NET SDK.

$ sudo add-apt-repository universe
$ sudo apt-get install apt-transport-https
$ sudo apt-get update
$ sudo apt-get install dotnet-sdk-2.2

ตรวจสอบหลังการติดตั้ง

$ dotnet --version
2.2.402

Link