2020년 12월 5일 토요일

How To Install Docker on Odroid-C2 (or ARM64)

How To Install Docker on Odroid-C2 (or ARM64)
  Environment
    Device : Odroid-C2
    OS : Ubuntu-20.04





1. Install Docker Engine


1) Uninstall old versions
$ sudo apt remove docker docker-engine docker.io containerd runc
2) Insert Docker Repository
$ sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-key fingerprint 0EBFCD88
$ sudo apt update
3) Install Docker Engine
$ sudo apt install docker-ce docker-ce-cli containerd.io -y
$ sudo usermod -aG docker $USER
4) Verify Docker Engine
$ sudo docker run hello-world

2. Install Docker Compose


$ sudo apt install python3-pip libffi-dev -y
$ sudo pip3 install docker-compose

How to Install Ubuntu on HDD (or SSD of USB) at Odroid-HC2

How to Install Ubuntu on HDD (or SSD of USB) at Odroid-HC2<\/h1>
  Environment
    Device : Odroid-HC2
    OS : Ubuntu-20.04
    Root Partition :   mmcblk1p2 ==> sda1





※ System on MicroSD is very Slow. If you want Faster System, you can Install System on HDD(or SSD of USB) by following the Steps.

※ Device that is not Supported booting from HDD or SSD or USB has same procedure


1. Re-partitioning HDD


1) Check Partition

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            925M     0  925M   0% /dev
tmpfs           200M  3.6M  196M   2% /run
/dev/mmcblk1p2   30G  4.9G   25G  17% /
...
/dev/mmcblk1p1  128M   23M  106M  18% /media/boot
tmpfs           200M  8.0K  200M   1% /run/user/121
tmpfs           200M  4.0K  200M   1% /run/user/1001

2) Re-Partitioning HDD

$sudo fdisk -l
...
Disk /dev/sda: 298.9 GiB, 320072933376 bytes, 625142448 sectors
Disk model:
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: FA88429A-0C8A-3D4E-90A8-CDB019307B6C
$ sudo fdisk /dev/sda
Command (m for help): g
Created a new GPT disklabel (GUID: 200F0D86-C2B4-CB4A-BD51-E9F766D736FE).

Command (m for help): n
Partition number (1-128, default 1):
First sector (2048-625142414, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-625142414, default 625142414): +100G

Created a new partition 1 of type 'Linux filesystem' and of size 100 GiB.
Partition #1 contains a vfat signature.

Do you want to remove the signature? [Y]es/[N]o: y

The signature will be removed by a write command.

Command (m for help): p
Disk /dev/sda: 298.9 GiB, 320072933376 bytes, 625142448 sectors
Disk model:
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 200F0D86-C2B4-CB4A-BD51-E9F766D736FE

Device     Start       End   Sectors  Size Type
/dev/sda1   2048 209717247 209715200  100G Linux filesystem

Filesystem/RAID signature on partition 1 will be wiped.

Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

※ The above is a 100GB sda1 created for work after initializing the HDD.

※ Proceed according to your Situation


2. Format as an EXT4 and Mount


1) Format HDD(or SSD or USB) Partition to EXT4
$ sudo mkfs.ext4 /dev/sda1
2) Mount HDD(or SSD or USB) Partition
$ sudo mkdir -p /media/sys
$ sudo mount /dev/sda1 /media/sys
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            925M     0  925M   0% /dev
tmpfs           200M  3.6M  196M   2% /run
/dev/mmcblk1p2   30G  4.9G   25G  17% /
...
/dev/mmcblk1p1  128M   23M  106M  18% /media/boot
tmpfs           200M  8.0K  200M   1% /run/user/121
tmpfs           200M  4.0K  200M   1% /run/user/1001
/dev/sda1        98G   61M   93G   1% /media/sys

3. Modify Setup files


1) Check UUID
$ sudo lsblk -f
NAME        FSTYPE   LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINT
...
sda
`-sda1      ext4            eed45733-3551-4b98-b081-bf7aa29490d1   92.9G     0% /media/sys
mmcblk1
|-mmcblk1p1 vfat     boot   52AA-6867                             105.4M    17% /media/boot
`-mmcblk1p2 ext4     rootfs e139ce78-9841-40fe-8823-96a304a09859   24.3G    17% /
2) Modify boot.ini

Change root UUID from mmcblk1p2 to sda1

$ sudo cp /media/boot/boot.ini /media/boot/boot.ini.orig
$ sudo nano /media/boot/boot.ini
Change Configuration
# Boot Args
setenv bootargs "console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0 ${videoconfig} ${hdmi_phy_control} ${hid_quirks} smsc95xx.macaddr=${macaddr} ${external_watchdog}"
==>
# Boot Args
setenv bootargs "console=tty1 console=ttySAC2,115200n8 root=UUID=eed45733-3551-4b98-b081-bf7aa29490d1 rootwait ro fsck.repair=yes net.ifnames=0 ${videoconfig} ${hdmi_phy_control} ${hid_quirks} smsc95xx.macaddr=${macaddr} ${external_watchdog}"
3) Modify fstab

Change root from mmcblk1p2 to sda1

$ sudo cp /etc/fstab /etc/fstab.orig
$ sudo nano /etc/fstab
Change Configuration
UUID=e139ce78-9841-40fe-8823-96a304a09859 / ext4 errors=remount-ro,noatime 0 1
LABEL=boot /media/boot vfat defaults 0 1
==>
#UUID=e139ce78-9841-40fe-8823-96a304a09859 / ext4 errors=remount-ro,noatime 0 1
LABEL=boot /media/boot vfat defaults 0 1
/dev/sda1 / ext4 defaults,noatime 0 1

4. Copy the root partition


$ sudo rsync -axv / /media/sys/

5. Check Root Partition


1) Reset System
2) Check Root Partition
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            925M     0  925M   0% /dev
tmpfs           200M  3.6M  196M   2% /run
/dev/sda1        98G  5.8G   88G   7% /
...
/dev/mmcblk1p1  128M   23M  106M  18% /media/boot
tmpfs           200M  8.0K  200M   1% /run/user/121
tmpfs           200M  4.0K  200M   1% /run/user/1001

How to Install Anaconda on Ubuntu

How to Install Anaconda on Ubuntu<\/h1>
  Environment
    Device : x86_x64
    OS : Ubuntu-20.04




※ If you want to install Conda on ARM64,

you can do it by MiniForge (Conda for ARM64)



1. Generate New Account for Anaconda


$ sudo adduser conda
Adding user `conda' ...
Adding new group `conda' (1001) ...
Adding new user `conda' (1001) with group `conda' ...
Creating home directory `/home/conda' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for aa
Enter the new value, or press ENTER for the default
        Full Name []: conda
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n]
$ su conda

2. Install Anaconda


1) Download Anaconda
$ cd ~
$ wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
$ ls
$ bash Anaconda3-2020.11-Linux-x86_64.sh
$ exit

※ Install Mini-Forge to Install on ARM64

$ su conda
$ cd ~

Upgrade Conda Environment

$ conda update --all -y
        
2) Generate Python2.7 Environment

Generate Conda Environment

$ conda create -n conda27 anaconda python=2.7 -y

Activate Conda Environment

$ conda activate conda27

Upgrade Conda Environment

$ conda update --al -yl

Install Packages

$ conda install paramiko pymysql beautifulsoup4 jupyterlab pandas -y

Deactivate Conda Environment

$ conda deactivate

3) Generate Python3.7 Environment

Generate Conda Environment

$ conda create -n conda37 anaconda python=3.7 -y

Activate Conda Environment

$ conda activate conda37

Upgrade Conda Environment

$ conda update --all -y

Install Packages

$ conda install paramiko pymysql bs4 jupyterlab pandas tensorflow -y

Deactivate Conda Environment

$ conda deactivate

4) Generate Python3.8 Environment

Generate Conda Environment

$ conda create -n conda38 anaconda python=3.8 -y

Activate Conda Environment

$ conda activate conda38

Upgrade Conda Environment

$ conda update --all -y

Install Packages

$ conda install paramiko pymysql bs4 jupyterlab pandas tensorflow -y

Deactivate Conda Environment

$ conda deactivate

※ Anaconda for Windows10 is Not Supported tensorflow on Python3.8


Basic Command of Conda


Show installed Environments List

conda env list

Generate an Environment

conda create -n yourenvironment yourpackages

Remove an Environment

conda remove --name myenv

Upgrade an Package

conda update mypackage

Upgrade all Packages

conda update --all

Show installed Packages

conda list

2020년 10월 26일 월요일

How to Install WordPress with Mairadb(or MySQL) on Ubuntu-20.04

How to Install WordPress with Mairadb(or MySQL) on Ubuntu-20.04


    Environment
      Device :  Odroid-HC2
      OS : Ubuntu-20.04
      HostName : test
      IP : 192.168.101.100
      Pre Insall App : Mairadb(or MySQL), NGINX, PHP


1. Install wordpress


$ sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip php-net-ldap2 php-net-ldap3 php-net-idna2 -y
$ wget https://wordpress.org/latest.zip
$ unzip latest.zip

2. Generate database for wordpress



WordPress
   SQL database : wordpress
   SQL userid : wordpress
   SQL password : test@test

※ Change it to suit your environment

$ sudo mysql -u root
> create database wordpress;
> grant all on wordpress.* to wordpress@localhost identified by 'test@test';
> flush privileges;
> quit;

3. Copy WordPress


$ sudo cp -R wordpress /var/www/html/wp
$ sudo chown  -R www-data:www-data /var/www/html/wp
$ sudo ls /var/www/html/ -l

4. Generate WordPress Initial Setting



WordPress
  SQL database : wordpress
  SQL userid : wordpress
  SQL password : test@test

※ Change it to suit your environment

Connet to WordPress Web (http://192.168.101.100/wp)
Select your Language
Insert your Database Information
Insert your WordPress Infomation
Login your Account
Change your Theme

2020년 10월 15일 목요일

How to Install Windows Fonts on Ubuntu

 How to Install Windows Fonts on Ubuntu


    Environment
      PC1 :
        Device : x64
        OS : Windows10
      PC2 :
        Device : Odroid-HC2(or XU4)
        OS : Ubuntu-20.04





1. Upload Windows Truetype Fonts to Ubuntu


Compressed Fonts Files on Windows
> mkdir TTF
> cd TTF
> copy C:\Windows\Fonts\*.ttf .\TTF\
> copy C:\Windows\Fonts\*.ttc .\TTF\

Compress TTF Folder

Copy Compressed File to Ubuntu

2. Install Truetype Fonts on Ubuntu


$ unzip TTF.zip
$ sudo cp -R TTF /usr/share/fonts/truetype/
$ sudo fc-cache -v -f

How to Install XRDP

 How to Install XRDP


##############################################################

Environment

  Device :  Odroid-HC2(orXU4)

  OS : Ubuntu-20.04

##############################################################





1. Install XRDP


$ sudo install xrdp icewm -y
$ sudo install icewm -y
$ cp /etc/xrdp/startwm.sh /etc/xrdp/startwm.sh.orig
$ nano /etc/xrdp/startwm.sh

Change Configuration

test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession

==>

#test -x /etc/X11/Xsession && exec /etc/X11/Xsession
#exec /bin/sh /etc/X11/Xsession
exec icewm-session


2020년 10월 8일 목요일

How To Install Armbian(Ubuntu Focal:20.04) on Orange Pi R1

 How To Install Armbian(Ubuntu Focal:20.04) on Orange Pi R1

======================================

Environment

  Device : Orange Pi R1

  OS : Armbian(Ubuntu Focal:20.04)

  HostName : r1

  Ethernet Interfaces

   Main : enxc0742bfff848 :  192.168.101.101/24 (gw 192.168.101.1)

   Sub  : eth0 :  192.168.1.101/24

======================================


※ Odroid-C1 is not recommended.

  no HDMI output (serial console only)

  no USB hotplugging, power the board with USB device is needed

  eMMC not supported

  Limited SD card brand (known to work well)


※ Odroid-C2 is not recommended.

  It has USB troubles

  It can't Reset





1. Install Armbian(Ubuntu Focal:20.04) on Orange Pi R1

Download Armbian(Ubuntu Focal:20.04) Image from Armbian Website

Install Armbian(Ubuntu Focal:20.04) with balenaEtcher on Micro SD

Install Micro SD On Orange Pi R1

Power on Orange Pi R1

Search IP with Angry IP Scanner on Orange Pi R1


2. Initial Setup

1) Setup Initial Account

### default password of Armbian

userid : root

password : 1234


### Change password of root

New root password: ********
Repeat password: ********


### Create New Account

Please provide a username (eg. your forename): test
Create password: ********
Repeat password: ********

Please provide your real name (eg. John Doe): test

Dear test, your account test has been created and is sudo enabled.
Please use this account for your daily work from now on.


2) Change Network IP

#### Setup Main Ethernet Interface

# nmcli con show
# nmcli con add con-name "Main" ifname  enxc0742bfff848 type ethernet  ip4 192.168.101.101/24 gw4 192.168.101.1
# nmcli con modify Main ipv4.dns 8.8.8.8
# nmcli con modify Main ipv4.dns-search test.com
# nmcli con modify Main ipv4.method manual


#### Setup Sub Ethernet Interface

# nmcli con add con-name "Sub" ifname  eth0 type ethernet  ip4 192.168.1.101/24


#### Remove Ethernet Interface Old IP

# nmcli con delete "Wired connection 2"
# nmcli con delete "Wired connection 1"


#### Connect to Main Interfacs New IP (192.168.101.5)


3) Change hostname & domainname

# hostname
# cp /etc/hostname /etc/hostname.orig
# nano /etc/hostname

Change Configuration

orangepi-r1

==>

r1
# cp /etc/hosts /etc/hosts.orig
# nano /etc/hosts

Change Configuration

127.0.0.1   localhost orangepi-r1
::1         localhost orangepi-r1 ip6-localhost ip6-loopback

==>

127.0.0.1   localhost r1 r1.test.com
::1         localhost r1 r1.test.com ip6-localhost ip6-loopback


# cp /etc/hostname /etc/hostname.orig
# nano /etc/hostname

Change Configuration

orangepi-r1

===>

r1
# shutdown -r now


4) Upgrade all package

$ sudo apt update ; sudo apt dist-upgrade -y ; sudo apt autoremove -y
$ sudo shutdown -r now


5) Setup IP Forwarding 

$ sudo cp /etc/sysctl.conf /etc/sysctl.conf.orig
$ sudo nano /etc/sysctl.conf

Change Configuration

#net.ipv4.ip_forward=1

===>

net.ipv4.ip_forward=1
$ sudo sysctl -p /etc/sysctl.conf
$ sudo shutdown -r now


6) Install UFW(Ubuntu FireWall) (Option)

$ sudo apt install ufw -y
$ sudo ufw enable
$ sudo ufw allow ssh
$ sudo ufw status
$ sudo cp /etc/default/ufw /etc/default/ufw.orig
$ sudo nano /etc/default/ufw

Change Configuration

DEFAULT_FORWARD_POLICY="DROP"

===>

DEFAULT_FORWARD_POLICY="ACCEPT"

How To Install Docker on Odroid-C2 (or ARM64)

How To Install Docker on Odroid-C2 (or ARM64) Environment Device : Odroid-C2 OS : Ubuntu-20.04 1. Install Dock...