AWS is good, but I still want to build my own server. I bought the Raspberry Pi 4 8G, which has become a hot topic recently, on Amazon for about 15,000 yen. What is the OS? Winsdows10 (ARM) also works, but is there a problem with heat generation? It seems that CentOS 8 can be operated when I searched for it on Linux Server, this time I will verify with CentOS 8.
Download from the following site. https://people.centos.org/pgreco/CentOS-Userland-8-stream-aarch64-RaspberryPI-Minimal-4/ CentOS-Userland-8-stream-aarch64-RaspberryPI-Minimal-4-sda.raw.xz Remarks: For the reason for using Steam, refer to the following site. From CentOS to CentOS Stream https://qiita.com/yamada-hakase/items/1629d511ab4199d253b4
This time, from the Raspbery site https://www.raspberrypi.org/ I downloaded, installed and used the tool. SD card initialization and OS image writing were completed. Remarks: For MicroSD, I purchased "SanDisk microSD 128GB UHS-I Class10 read maximum 100MB/s [Nintendo Switch manufacturer operation confirmed] SanDisk Ultra SDSQUAR-128G-EPK Eco Package".
$ uname -a
Linux raspi4 5.4.60-v8.1.el8 #1 SMP PREEMPT Sun Aug 23 02:58:38 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
$ free
total used free shared buff/cache available
Mem: 8003272 614636 1649640 78068 5738996 7227932
Swap: 499708 0 499708
Remarks: I think that there is no problem with 8GB of memory on OS 64bi.
$ df
Filesys 1K-Block can be used can be used%Mount position
/dev/root 2241560 1956648 245092 89% /
devtmpfs 3968356 0 3968356 0% /dev
tmpfs 4001636 0 4001636 0% /dev/shm
tmpfs 4001636 24960 3976676 1% /run
tmpfs 4001636 0 4001636 0% /sys/fs/cgroup
/dev/mmcblk0p1 292696 56664 236032 20% /boot
tmpfs 800324 0 800324 0% /run/user/1000
Trouble: Only 2GB is recognized! I searched the net and executed the command.
$ /usr/bin/rootfs-expand
Restart.
$ df
Filesys 1K-Block can be used can be used%Mount position
/dev/root 122069752 1645876 120384056 2% /
devtmpfs 3968356 0 3968356 0% /dev
tmpfs 4001636 0 4001636 0% /dev/shm
tmpfs 4001636 16792 3984844 1% /run
tmpfs 4001636 0 4001636 0% /sys/fs/cgroup
/dev/mmcblk0p1 292696 56664 236032 20% /boot
tmpfs 800324 0 800324 0% /run/
Recognized 120GB!
https://www.server-world.info/query?os=CentOS_8&p=install Remarks: This is the site I have referred to before. Since I introduced CentOS8, I referred to it as an ordinary server. Setting items include time zone setting, user creation, password reset, SSH, fixed IP setting, etc.
$ curl https://download.docker.com/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo
$ sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/docker-ce.repo
$ dnf --enablerepo=docker-ce-stable -y install docker-ce
$ systemctl enable --now docker
I checked the version.
$ docker --version
Docker version 20.10.1, build 831ebea
I referred to the following site. Build docker-compose for Raspberry Pi (1.25.0 or later) https://qiita.com/tkyonezu/items/912fb7cfaab2f59276dd
$ git clone https://github.com/docker/compose.git
$ cd compose
$ git checkout 1.25.0 → git checkout 1.27.Change to 4(No confidence result all right?)
# git checkout 1.27.4
Previous HEAD position was 4038169d Merge pull request #7028 from docker/bump-1.25.0
HEAD is now at 40524192 "Bump 1.27.4"
Remarks: https://github.com/docker/compose/blob/master/CHANGELOG.md I checked the version at.
I ran the build.
$ ./script/build/linux
As a result on the way, it seems to have succeeded.
Successfully built e731e12ae43e
Successfully tagged docker/compose:tmp-glibc-linux-binary-40524192
Check the binary version.
$ cd dist
$ ./docker-compose-Linux-aarch64 --version
docker-compose version 1.25.0,build 4038169d → for some reason 1.25.0
Gives copy execution rights to binaries.
$ sudo cp docker-compose-Linux-aarch64 /usr/local/bin/docker-compose
$ cd /usr/local/bin
$ sudo chown root:root docker-compose
$ sudo chmod 755 docker-compose
I checked the version.
$ docker-compose --version
docker-compose version 1.27.4, build 40524192
Remarks: I used MariaDB because MySql could not be used.
Create a working folder.
# mkdir ~/docker_wp Create in any folder
$ cd docker_wp
$ nano docker-compose.yml
docker-compose.yml
version: '3.3'
services:
db:
image: mariadb:latest
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root-pass
wordpress1:
depends_on:
- db
image: wordpress:latest
volumes:
- ./wp1:/var/www/html
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: root-pass
WORDPRESS_DB_NAME: wp1-db
wordpress2:
depends_on:
- db
image: wordpress:latest
volumes:
- ./wp2:/var/www/html
ports:
- "8010:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: root-pass
WORDPRESS_DB_NAME: wp2-db
volumes:
db_data: {}
Remarks: User name, password, host name, database name, port number, etc. are arbitrary.
$ douker-compose up -d
mariadb and wordpress have started.
# docker-compose ps
Name Command State Ports
--------------------------------------------------------------------------------------
docker_wp_db_1 docker-entrypoint.sh mysqld Up 3306/tcp
docker_wp_wordpress1_1 docker-entrypoint.sh apach ... Up 0.0.0.0:8000->80/tcp
docker_wp_wordpress2_1 docker-entrypoint.sh apach ... Up 0.0.0.0:8010->80/tcp
I checked the database.
# docker exec -i -t docker_wp_db_1 /bin/bash
# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.5.8-MariaDB-1:10.5.8+maria~focal mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| wp1-db |
| wp2-db |
+--------------------+
5 rows in set (0.001 sec)
Execute http: // fixed IP: 8000/and http: // fixed IP: 8010/in your browser.
Remarks: After setting SSH, the work is carried out at the terminal from MacBook.
In this verification, the Raspberry Pi4 8G seems to have a margin in terms of specifications. From now on, this is my expectation!
Recommended Posts