Archlinux Installation in Oracle Cloud

인스턴스 생성 / 이미지 및 구성 / 이미지 소스에서 Archlinux image 선택 후 이미지 선택

SSH 키 추가하고

사용자정의 부트 볼륨 크기 지정

고급옵션표시 / Cloud-init 스크립트 붙여넣기 아래 내용 입력
Oracle Cloud 에이전트에서 플러그인 선택해제후 생성

system_info: 
  default_user: 
    name: arch 
    lock_passwd: True 
    gecos: arch Cloud User 
    groups: [wheel, adm] 
    sudo: ["ALL=(ALL) NOPASSWD:ALL"] 
    shell: /bin/bash 
#cloud-config 
users: 
- name: arch 
  ssh_authorized_keys:
    ssh-rsa AAAAB3N……

생성되었으면
1분정도 뒤 ssh로 접속

[arch@instance-20230128-1123 pacman.d]$ sudo -i
[root@instance-20230128-1123 ~]# echo "Server = http://mirror.premi.st/archlinux/$repo/os/$arch" > mirrorlist
[root@instance-20230128-1123 ~]pacman -Sy archlinux-keyring
[root@instance-20230128-1123 ~]pacman-key --refresh-keys
[root@instance-20230128-1123 ~]pacman -Syu && yes | paman -Scc
[root@instance-20230128-1123 ~]pacman -S vi

systemd/Timers

archlinux를 기본설치하면 cron이 설치되지 않는다.

cronie 를 설치할까하다, systemd/Timers 를 이용하여 매일 package를 업데이트하도록 설정한다.

[arch@seobi.gq system]$ cd /etc/systemd/system
[arch@seobi.gq system]$ cat pacsyu.service
[Unit]
Description=package upgrade

[Service]
ExecStart=pacman -Syu --noconfirm && yes|pacman -Scc

[arch@seobi.gq system]$ cat pacsyu.timer
[Unit]
Description=package upgrade timer

[Timer]
OnBootSec=1min
OnCalendar=*-*-* 4:0:0

[Install]
WantedBy=multi-user.target

[arch@seobi.gq system]$ sudo systemctl enable pacsyu.timer
[arch@seobi.gq system]$ sudo systemctl start pacsyu.timer
[arch@seobi.gq system]$ systemctl list-timers
NEXT                        LEFT     LAST                        PASSED   UNIT                     >
Fri 2022-06-24 18:12:18 KST 8h left  Thu 2022-06-23 18:12:18 KST 15h ago  systemd-tmpfiles-clean.ti>
Sat 2022-06-25 00:00:00 KST 14h left Fri 2022-06-24 00:00:38 KST 9h ago   shadow.timer             >
Sat 2022-06-25 04:00:00 KST 18h left Fri 2022-06-24 09:46:33 KST 7min ago pacsyu.timer             >

3 timers listed.
Pass --all to see loaded but inactive timers, too.

참고 : https://wiki.archlinux.org/title/Systemd/Timers

Desktop Specification

[joseph@archlinux sway]$ head /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 4
model name : AMD Phenom(tm) II X3 710 Processor
stepping : 2
microcode : 0x10000db
cpu MHz : 800.000
cache size : 512 KB
physical id : 0
[joseph@archlinux sway]$ grep bogo /proc/cpuinfo
bogomips : 5225.50
bogomips : 5225.50
bogomips : 5225.50
[joseph@archlinux sway]$ free -h
total used free shared buff/cache available
Mem: 3.8Gi 420Mi 2.5Gi 92Mi 945Mi 3.1Gi
Swap: 2.0Gi 0B 2.0Gi
[joseph@archlinux sway]$ sudo fdisk -l | grep ^Disk
Disk /dev/sda: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: OCZ-VERTEX3 MI
Disklabel type: dos
Disk identifier: 0x21c61497
Disk /dev/sdb: 232.89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: SAMSUNG HD250HJ
Disklabel type: dos
Disk identifier: 0x334e334d
[joseph@myarch sway]$ head /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel(R) Pentium(R) CPU G860 @ 3.00GHz
stepping : 7
microcode : 0x25
cpu MHz : 1864.704
cache size : 3072 KB
physical id : 0
[joseph@myarch sway]$ grep bogo /proc/cpuinfo
bogomips : 5988.68
bogomips : 5988.68
[joseph@myarch sway]$ free -h
total used free shared buff/cache available
Mem: 1.8Gi 446Mi 440Mi 91Mi 908Mi 1.0Gi
Swap: 2.0Gi 0B 2.0Gi
[joseph@myarch sway]$ sudo fdisk -l | grep ^Disk
Disk /dev/sda: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: WDC WD5000BEVT-2
Disklabel type: dos
Disk identifier: 0xf5ff8098
[joseph@archlinux ~]$ head /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	: Intel(R) Core(TM) i3-2100 CPU @ 3.10GHz
stepping	: 7
microcode	: 0x23
cpu MHz		: 3100.000
cache size	: 3072 KB
physical id	: 0
[joseph@archlinux ~]$ grep bogo /proc/cpuinfo
bogomips : 6188.38
bogomips : 6188.38
bogomips : 6188.38
bogomips : 6188.38
[joseph@archlinux ~]$ free -h
total used free shared buff/cache available
Mem: 3.8Gi 429Mi 2.3Gi 63Mi 1.0Gi 3.1Gi
Swap: 2.0Gi 0B 2.0Gi

OCI CLI Object Storage

  • Bucket의 Object 조회
yongsub_yu@cloudshell:~ (ap-seoul-1)$ oci os object list -ns cnsbwisrzyoz -bn storage
{
"data": [
{
"archival-state": null,
"etag": "f99d8e28-1cae-48c6-af7d-b9fc8de33e52",
"md5": "YSvTrFJcP6fHtig88uPGvQ==",
"name": "NPKI.zip",
"size": 10102,
"storage-tier": "Standard",
"time-created": "2020-12-09T04:38:05.645000+00:00",
"time-modified": "2020-12-09T04:38:05.663000+00:00"
}
],
"prefixes": []
}
  • Bucket에 Object 업로드
yongsub_yu@cloudshell:~ (ap-seoul-1)$ oci os object put -ns cnsbwisrzyoz -bn storage --file .bashrc
{
"etag": "06ec70dd-84d9-4118-aeba-e5501b1fcc93",
"last-modified": "Wed, 11 Aug 2021 00:10:12 GMT",
"opc-content-md5": "4fMsu5L917P9e9Q7y0uvAQ=="
}

Oracle cloud shell

oracle cloud 서버에 접속하기 위해 cloud shell에 접속환경을 만들었다.

ssh key 생성

아래와 같이 private key, public key 생성

yongsub_yu@cloudshell:~ (ap-seoul-1)$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/yongsub_yu/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/yongsub_yu/.ssh/id_rsa.
Your public key has been saved in /home/yongsub_yu/.ssh/id_rsa.pub.
The key fingerprint is:
The key's randomart image is:
+---[RSA 2048]----+
|      .o   .+    |
|     .. = +=o.  o|
|      .B BEoo+ +.|
|    ..+o=.=.. =  |
|     o.oSo o + . |
|     ...o . . +  |
|      ..   o .   |
|        . o +... |
|         . =ooo.+|
+----[SHA256]-----+

접속대상 서버의 .ssh/autorized_key 파일에 위에서 생성된 public_key 등록

접속할 서버 .ssh/config 에 등록

yongsub_yu@cloudshell:~ (ap-seoul-1)$ cat .ssh/config
Host
HostName
User
IdentityFile ~/.ssh/id_rsa
Host
HostName
User
IdentityFile ~/.ssh/id_rsa
Host
HostName
User
IdentityFile ~/.ssh/id_rsa
Host sbg
HostName
User
IdentityFile ~/.ssh/id_rsa

cloud shell의 Public IP 조회

cloud shell에서 아래와 같이 Public IP를 조회하고

yongsub_yu@cloudshell:~ (ap-seoul-1)$ curl ipecho.net/plain
132.145.85.85

firewall 정책 추가

Oracle cloud free tier vm benchmark

Oracle cloud free tier Ampere Arm A1 를 설치하고 기존 E2.1.Micro 머신과 성능면에서 어떤 차이가 있는지 테스트 해보았다.

생성한 인스턴스는 3개이다.

E2 머신은 2개까지 생성할 수 있으며 각각 1 OCPU, 1GB MEM 이다.

A1 머신은 arm 4 OCPU, 24GB MEM이다.

그리고 스토리지는 200GB까지 제공된다.

E2.1.Micro 2*50GB, A1.Flex 100GB

sysbench 테스트 결과

왼쪽 A1.Flex(threads=4), 오른쪽 E2.1.Micro(threads=2)

CPU Test
Memory Test
Fileio Test

geekbench 테스트 결과

A1.Flex
E2.1.Micro
Compare : A1.Flex vs E2.1.Micro

Internet speed test

A1.Flex

ubuntu@joseph.home.kg:~$ speedtest-cli --server 6527
Retrieving speedtest.net configuration...
Testing from Oracle Cloud (146.56.135.248)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by kdatacenter.com (Seoul) [1.72 km]: 126.767 ms
Testing download speed................................................................................
Download: 327.15 Mbit/s
Testing upload speed......................................................................................................
Upload: 286.66 Mbit/s

E2.1.Micro

ubuntu@joseph.ml:~$ speedtest-cli --server 6527
Retrieving speedtest.net configuration...
Testing from Oracle Cloud (132.226.174.165)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by kdatacenter.com (Seoul) [1.72 km]: 25.31 ms
Testing download speed................................................................................
Download: 47.77 Mbit/s
Testing upload speed......................................................................................................
Upload: 49.24 Mbit/s

GCP e2-micro (2 vCPUs, 1 GB memory)

sysbench

ubuntu@seobi.ga:~/.ssh$ sysbench cpu --threads=2 run
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 2
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
    events per second:  1434.84
General statistics:
    total time:                          10.0006s
    total number of events:              14352
Latency (ms):
         min:                                    1.25
         avg:                                    1.39
         max:                                    1.75
         95th percentile:                        1.42
         sum:                                19993.78
Threads fairness:
    events (avg/stddev):           7176.0000/0.00
    execution time (avg/stddev):   9.9969/0.00
ubuntu@seobi.ga:~/.ssh$ sysbench memory --threads=2 run
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 2
Initializing random number generator from current time
Running memory speed test with the following options:
  block size: 1KiB
  total size: 102400MiB
  operation: write
  scope: global
Initializing worker threads...
Threads started!
Total operations: 60038571 (6002657.69 per second)
58631.42 MiB transferred (5861.97 MiB/sec)
General statistics:
    total time:                          10.0001s
    total number of events:              60038571
Latency (ms):
         min:                                    0.00
         avg:                                    0.00
         max:                                    0.53
         95th percentile:                        0.00
         sum:                                11801.23
Threads fairness:
    events (avg/stddev):           30019285.5000/13537.50
    execution time (avg/stddev):   5.9006/0.00
ubuntu@seobi.ga:~/.ssh$ sysbench fileio --file-test-mode=seqwr --threads=2 run
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 2
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential write (creation) test
Initializing worker threads...
Threads started!
File operations:
    reads/s:                      0.00
    writes/s:                     11316.04
    fsyncs/s:                     14504.31
Throughput:
    read, MiB/s:                  0.00
    written, MiB/s:               176.81
General statistics:
    total time:                          10.0106s
    total number of events:              258266
Latency (ms):
         min:                                    0.01
         avg:                                    0.08
         max:                                    7.62
         95th percentile:                        0.12
         sum:                                19870.63
Threads fairness:
    events (avg/stddev):           129133.0000/1827.00
    execution time (avg/stddev):   9.9353/0.00

geekbench

speedtest

yongsub_yun@instance-1:~/tmp$ speedtest-cli --server 35180
Retrieving speedtest.net configuration...
Testing from Google Cloud (35.233.201.214)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by Ziply Fiber (Seattle, WA) [239.62 km]: 7.884 ms
Testing download speed................................................................................
Download: 2262.39 Mbit/s
Testing upload speed......................................................................................................
Upload: 869.60 Mbit/s