แสดงบทความที่มีป้ายกำกับ Ubuntu 18.04 แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ Ubuntu 18.04 แสดงบทความทั้งหมด

วันพฤหัสบดีที่ 28 พฤศจิกายน พ.ศ. 2562

การล้างข้อมูลในฐานข้อมูลและโหลด Config ใหม่ให้ DSpace CRIS

การล้างข้อมูลนั้นเราทำหลายครั้งก่อนที่เราจะใช้งาน DSpace CRIS จริงๆ เพราะว่าต้องทดลองใช้งานหลาย ๆ อย่าง จึงทำให้ฐานข้อมูลมีข้อมูลที่เราไม่ใช้จำนวนมาก
sudo su - postgres

psql dspace -c "DROP EXTENSION pgcrypto;"
exit;

sudo /data/dspace/bin/dspace database info
sudo /data/dspace/bin/dspace clean


sudo su - postgres
psql dspace -c "CREATE EXTENSION pgcrypto;"
exit;
# - load-cris-configuration: Load CRIS configuration from an XLS file
# - export-cris-configuration: Export CRIS configuration from an XLS file

sudo /data/dspace/bin/dspace load-cris-configuration -f /data/upload/configuration.xls

การ Load Registry ครั้งแรกเมื่อทำการ Load แล้วให้เราทำการ Restart Server ก่อน 1 ครั้งสำหรับ Registry Schema ใหม่
sudo /data/dspace/bin/dspace registry-loader -metadata /data/upload/patent-types.xml

วันอาทิตย์ที่ 24 พฤศจิกายน พ.ศ. 2562

DSpace CRIS แก้ DC Type ที่เป็น All Theses ขึ้น ???

ข้อมูลจาก: DSpace Tech Support



เมื่อทำการทดสอบใช้งาน DSpace CRIS หลังจากติดตั้งไปสักพัก เมื่อทำการเพิ่ม Item แล้วเลือก DC Type เป็น Theses เราจะพบว่าหน้าแรกที่ใช้สรุปว่ามี Item ประเภทไหนบ้าง เราจะเจอความผิดพลาดที่ว่า All Theses หาข้อความไม่เจอ

วันศุกร์ที่ 22 พฤศจิกายน พ.ศ. 2562

PHP ปรับค่า File Upload และค่า Timeout

ข้อมูลจาก: Sitepoint | A2Hosting | Strackoverflow | Mediatemplate

แก้ไขไฟล์ "php.ini" ใน "etc/php/5.6/apache2/php.ini" เสร็จแล้วให้ Restart Apache2
# รองรับการอัพโหลดไฟล์ที่ 300MB
upload_max_filesize = 300M

# รองรับการส่งไฟล์ผ่าน POST ที่ 300MB
post_max_size = 300M

# เพิ่มเวลาในการ Execution และ Input เป็น 600 วินาที
max_execution_time = 600
max_input_time = 600

# เพิ่มหน่วยความจำให้ PHP
memory_limit = 512M

วันอาทิตย์ที่ 10 พฤศจิกายน พ.ศ. 2562

การติดตั้ง DSpace CRIS 5 ใน Ubuntu 18.04

การเตรีมเครื่องติดตั้ง DSpace CRIS 5 เราจะทำตามขั้นตอนตามเว็บ โดยปัญหาที่เจอคือ OpenJDK เป็น Version 11 จะไม่สามารถใช้ Maven สั่ง Package ได้ให้เราทำการ ลง OpenJDK เป็น Version 8 ก่อนแล้วทำการติดตั้ง Maven ที่หลัง เพราะหากทำการติดตั้ง Maven ก่อนจะเป็นการเลือกเอา OpenJDK Version ล่าสุดมา
แล้วทำไมต้องใช้ OpenJDK Version 8 ? คือว่า Maven ตอนที่เราสั่ง Package มันจะต้องใช้ไฟล์ tools.jar ในของ Java ที่อยู่ใน Folder /lib/ ใน Java ซึ่งใน OpenJDK Version 9 ขึ้นไปจะไม่มีแล้ว อันนี้เราไม่รู้นะว่าทำไม ?
sudo apt install openjdk-8-jdk
sudo apt install ant git maven 

เสร็จแล้วก็ทำการลง Tomcat8 และ PostgreSQL แล้วทำการตั้งค่าตาม Manual แต่ Command อาจไม่ตรงตามนั้นแต่ก็ได้เหมือนกัน
sudo apt install tomcat8 postgresql postgresql-contrib

เมื่อเตรีมเครื่องพร้อมแล้วก็ทำตามขั้นตอนได้
การติดตั้ง PostgreSQL อ่านที่นี้, การติดตั้ง DSpace CRIS

วันศุกร์ที่ 30 สิงหาคม พ.ศ. 2562

ตั้งค่า Network โดยใช้ "netplan" บน Ubuntu 18.04

คำสั่งไม่ยุ่งยาก แค่ 3 คำสั่ง ถ้าใครลง Ubuntu 18.04 ก็ข้าม "netplan generate" ได้เลย
sudo netplan generate

# แก้ไขไฟล์
sudo nano /etc/netplan/50-cloud-init.yaml

# สั่งให้ใช้ค่าใหม่
sudo netplan apply

ตัวอย่างที่ผมใช้เป็นประจำ
network:
    ethernets:
        ens3:
            addresses:
            - 10.1.4.137/24
            gateway4: 10.1.4.254
            nameservers:
                addresses:
                - 192.168.1.3
                - 8.8.8.8
            routes:
            - to: 10.0.0.0/8
              via: 0.0.0.0
        ens4:
            addresses:
            - 192.168.0.137/24
            gateway4: 192.168.0.254
            nameservers:
                addresses:
                - 192.168.1.3
                - 8.8.8.8
    version: 2

วันพุธที่ 28 สิงหาคม พ.ศ. 2562

Install PHPMyAdmin Manual

ก่อนที่จะทำการดาวโหลด์ PHPMyAdmin ไฟล์ลงมาติดตั้งเอง ให้เราทำการติดตั้งตัว Unzip ก่อน
sudo apt install unzip

ให้เราย้ายไปอยู่ที่โฟลเดอร์ /usr/share ก่อนดาวโหลด์ (ถ้าลง PHPMyAdmin ผ่าน apt ก็จะมาอยู่ที่นี่เหมือนกัน)
จากนั้นทำการดาวโหลด์ไฟล์ phpMyAdmin-4.9.0.1-all-languages.zip จากเว็บไซต์ https://phpmyadmin.net
cd /usr/share
sudo wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.zip

# If Error Use This !
# sudo wget http://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.zip

เสร็จแล้วแตกไฟล์ออกจาก zip และเปลี่ยนชื่อโฟลเดอร์เป็น phpmyadmin เพื่อให้ง่ายต่อการใช้งาน
แล้วทำการเปลี่ยนเจ้าของและสิทธิ์การใช้งาน
sudo unzip phpMyAdmin-4.9.0.1-all-languages.zip

sudo mv phpMyAdmin-4.9.0.1-all-languages.zip phpmyadmin
sudo rm phpMyAdmin-4.9.0.1-all-languages.zip

sudo chown -R www-data: phpmyadmin
sudo chmod -R 744 phpmyadmin

เปิดไฟล์ Config และแก้ไขจากไฟล์ตัวอย่างที่มีมาให้
sudo cp phpmyadmin/config.sample.inc.php phpmyadmin/config.inc.php
sudo nano phpmyadmin/config.inc.php

วันจันทร์ที่ 26 สิงหาคม พ.ศ. 2562

Install PHP5 and PHP7 on Ubuntu 18.04

การติดตั้ง PHP5 บน Ubuntu 18.04 นั้นเราไม่สามารถใช้ Package Repository ที่มากับ Ubuntu 18.04 ได้
อย่างตอนที่ผมลง Ubuntu 18.04 เราจะได้ PHP ที่เป็น เวอร์ชั่นค่อนข้างใหม่คือ PHP 7.2
เราเลยจำเป็นต้องเพิ่ม Package Repository อีกตัวเขาไปเพื่อให้เราสามารถติดตั้ง PHP5 ได้

ให้เราทำการเพิ่ม Repository "ppa:ondrej/php"

วันศุกร์ที่ 10 พฤษภาคม พ.ศ. 2562

Install Apache Tomcat 8.5 on Ubuntu Server 18.04

# Search Package Apache Tomcat 8
sudo apt update
sudo apt search tomcat8*

# List
tomcat8/bionic-updates,bionic-security 8.5.39-1ubuntu1~18.04.1 all
  Apache Tomcat 8 - Servlet and JSP engine

tomcat8-admin/bionic-updates,bionic-security 8.5.39-1ubuntu1~18.04.1 all
  Apache Tomcat 8 - Servlet and JSP engine -- admin web applications

tomcat8-common/bionic-updates,bionic-security 8.5.39-1ubuntu1~18.04.1 all
  Apache Tomcat 8 - Servlet and JSP engine -- common files

tomcat8-docs/bionic-updates,bionic-security 8.5.39-1ubuntu1~18.04.1 all
  Apache Tomcat 8 - Servlet and JSP engine -- documentation

tomcat8-examples/bionic-updates,bionic-security 8.5.39-1ubuntu1~18.04.1 all
  Apache Tomcat 8 - Servlet and JSP engine -- example web applications

tomcat8-user/bionic-updates,bionic-security 8.5.39-1ubuntu1~18.04.1 all
  Apache Tomcat 8 - Servlet and JSP engine -- tools to create user instances

# Install Apache Tomcat 8, It will install [jre] and [tomcat8-common] with.
sudo apt install tomcat8

# Check Apache Tomcat 8 Status
sudo systemctl status tomcat8

# File Location
/var/lib/tomcat8/
/etc/tomcat8/

Check http://your-domain:8080 at your web browser

วันจันทร์ที่ 15 เมษายน พ.ศ. 2562

Install MySQL 5.7 on Ubuntu 18.04

Install MySQL Server 5.7

การติดตั้ง MySQL Server 5.7

Reference: Install MySQL | Install phpMyAdmin
# Install MySQL Server
sudo apt update
sudo apt install mysql-server

# Check MySQL Status
sudo systemctl status mysql
# Initial Server
sudo mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No:
Please set the password for root here.

New password:

Re-enter new password:
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) :

 ... skipping.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) :

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) :

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) :

 ... skipping.
All done!

วันศุกร์ที่ 12 เมษายน พ.ศ. 2562

Install PostgreSQL 11 on Ubuntu 18.04

การติดตั้ง PostgreSQL 11


*ถ้าไม่ต้องการติดตั้ง Version 11 จะลงตาม Version ที่มากับ Repository Linux ให้ข้ามไปตรง #Install PostgreSQL ได้เลยครับ

Official: PostgreSQL Installation
Reference: Install PostgreSQL, Install pgAdmin4, Getting Started
# Install PostgreSQL 
sudo apt update
sudo apt install wget gnupg2

Create the file /etc/apt/sources.list.d/pgdg.list and add repository
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
# Import repository signing key, then update package lists
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update

# Install PostgreSQL, ถ้าไม่ทำตามขั้นตอนข้างบนจะติดตั้งตาม Version ที่มากับ Repository ของ Linux
sudo apt install postgresql postgresql-contrib

# Check PostgreSQL Status
sudo systemctl status postgresql

ทำการทดสอบโดยใช้ user postgres
# Connect to PostgreSQL
sudo su - postgres
psql
-- Show your connection information

\connifo
-- You are connected to database "postgres" as user "postgres" 
-- via socket in "/var/run/postgresql" at port "5432".

-- Show help
\?

-- Quit
\q

วันเสาร์ที่ 6 เมษายน พ.ศ. 2562

Knowage 6.2 Installer in Ubuntu 18.04

I will follow this step for make sure it can work correctly


This video use Knowage 6.2.1 on Ubuntu 18 and Use Oracle JDK 8 and MySQL Server 5.7

Step 1. Install Java / Step 2. Configure System Variables

sudo apt install software-properties-common
sudo add-apt-repository ppa:webupd8team/java
sudo apt update

sudo apt install oracle-java8-installer
sudo apt install oracle-java8-set-default

# Setup JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$JAVA_HOME/bin:$PATH

# Verify JDK is Installed
java -version

# java version "1.8.0_201"
# Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
# Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
Reference: Command [add-apt-repository] Missing | Install Java 8 | Setup System Variables

วันอังคารที่ 26 กุมภาพันธ์ พ.ศ. 2562

ติดตั้ง XFCE4 และ VNC4Server บน Ubuntu 18.04

Desktop GUI ใช้ xfce4
VNC Server ใช้ vnc4server
sudo apt install xfce4 xfce4-goodies xfonts-thai
sudo apt install vnc4server

ก่อนใช้งานครั้งแรกเราต้องสร้างรหัสผ่านสำหรับเชื่อมต่อ VNC Server เสร็จแล้วสั่งให้ VNC Server ทำงานหนึ่งครั้ง
เสร็จแล้วเราจะได้ไฟล์ xstartup ขึ้นมา จากนั้นทำการปิด VNC Server แล้วเข้าไป แก้ไขไฟล์ xstartup ใน ~/.vnc/xstartup
vncpasswd
vncserver
vncserver -kill :1

nano ~/.vnc/xstartup
#!/bin/bash
startxfce4 &

เมื่อทำการแก้ไขค่าเรียบร้อยแล้วให้ทำการ Save แล้วสั่งให้ VNC Server ทำงานอีกครั้ง
พิมพ์ ss -ltn เพื่อตรวจสอบว่ามี Port 5901 เปิดใช้งานอยู่ แสดงว่า VNC Server ทำงานแล้ว
vncserver
ss -ltn

วันศุกร์ที่ 22 กุมภาพันธ์ พ.ศ. 2562

Python3 กับ Virtual Environment / PIP

ติดตั้ง "python3" และ "python3-venv" ก่อนใช้งาน
sudo apt install python3 python3-venv

การสร้าง Virtual Enviroment
python3 -m venv [enviroment-name]

การ Activate ให้เราสั่ง source /bin/activate และ Deactivate เมื่ออยู่ใน venv แล้วให้พิมพ์ deactivate
source (venv)/bin/activate
decactivate

วันพุธที่ 26 ธันวาคม พ.ศ. 2561

[Ubuntu] การแก้ไข Hostname, Time และ Local ใน Ubuntu 18.04

คำสั่งที่ใช้ในการดู Hostname
# ดูแค่ Hostname อย่างเดียว
hostname

# ดู Hostname และรายละเอียดอื่นๆ
hostnamectl

เมื่อเราต้องการเปลี่ยน Hostname เราสามารถเข้าไปแก้ไขไฟล์ "/etc/hosts" หรือใช้คำสั่ง "hostnamectl" ก็ได้
การใช้คำสั่ง "hostnamectl" ก็จะเป็นการแก้ไขไฟล์ "/etc/hosts" นั้นเองแต่เป็นการทำผ่านคำสั่ง
sudo hostnamectl set-hostname [new-hostname]

***เมื่อเราทำการแก้ Hostname ใน Ubuntu 18.04 แล้วทำการ Reboot อาจพบว่า Hostname กลับมาเป็นเหมือนเดิม

ให้เราทำการแก้ไขไฟล์ "/etc/cloud/cloud.cfg" ค่า "preserve_hostname:" เป็น "true" จากนั้น Save ไฟล์ แล้วทำการ set hostname ใหม่