忘備録 > サーバー構築6
Linuxによるサーバー構築メモ6 |
Intel® NUC キット BOXNUC7CJYH / Ubuntu 20.04LTS の大阪サーバーが OS サポートが切れるので
Intel® NUC キット BXNUC10I5FNHに 2TB の M.2 SSDを搭載して、Ubuntu 24.04LTS をインストールし後継機とする。
Ubuntu インストール後、論理パーティションをストレージいっぱいまで拡張する
$ df -h Filesystem Size Used Avail Use% Mounted on tmpfs 6.3G 1.6M 6.3G 1% /run efivarfs 192K 66K 122K 36% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 98G 11G 83G 12% / tmpfs 32G 0 32G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/nvme0n1p2 2.0G 101M 1.7G 6% /boot /dev/nvme0n1p1 1.1G 6.2M 1.1G 1% /boot/efi tmpfs 6.3G 12K 6.3G 1% /run/user/1000
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS nvme0n1 259:0 0 1.9T 0 disk ├─nvme0n1p1 259:1 0 1G 0 part /boot/efi ├─nvme0n1p2 259:2 0 2G 0 part /boot └─nvme0n1p3 259:3 0 1.9T 0 part └─ubuntu--vg-ubuntu--lv 252:0 0 100G 0 lvm /
$ sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv Size of logical volume ubuntu-vg/ubuntu-lv changed from 100.00 GiB (25600 extents) to 1.86 TiB (487597 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized.
$ df -h Filesystem Size Used Avail Use% Mounted on tmpfs 6.3G 1.6M 6.3G 1% /run efivarfs 192K 66K 122K 36% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 98G 11G 83G 12% / tmpfs 32G 0 32G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/nvme0n1p2 2.0G 101M 1.7G 6% /boot /dev/nvme0n1p1 1.1G 6.2M 1.1G 1% /boot/efi tmpfs 6.3G 12K 6.3G 1% /run/user/1000
$ sudo resize2fs /dev/ubuntu-vg/ubuntu-lv resize2fs 1.47.0 (5-Feb-2023) Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required old_desc_blocks = 13, new_desc_blocks = 239 The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 499299328 (4k) blocks long.
$ df -h Filesystem Size Used Avail Use% Mounted on tmpfs 6.3G 1.6M 6.3G 1% /run efivarfs 192K 66K 122K 36% /sys/firmware/efi/efivars /dev/mapper/ubuntu--vg-ubuntu--lv 1.9T 11G 1.8T 1% / tmpfs 32G 0 32G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/nvme0n1p2 2.0G 101M 1.7G 6% /boot /dev/nvme0n1p1 1.1G 6.2M 1.1G 1% /boot/efi tmpfs 6.3G 12K 6.3G 1% /run/user/1000
$ sudo apt -y update Hit:1 http://jp.archive.ubuntu.com/ubuntu noble InRelease Hit:2 http://jp.archive.ubuntu.com/ubuntu noble-updates InRelease Hit:3 http://jp.archive.ubuntu.com/ubuntu noble-backports InRelease Hit:4 http://security.ubuntu.com/ubuntu noble-security InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done 69 packages can be upgraded. Run 'apt list --upgradable' to see them.
$ sudo apt -y upgrade Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done :
$ sudo apt install net-tools
mizutu@ubuntu-osaka3:~$ ifconfig eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.89 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 2001:a453:6346:100:1e69:7aff:fea1:48f1 prefixlen 64 scopeid 0x0<global> inet6 fe80::1e69:7aff:fea1:48f1 prefixlen 64 scopeid 0x20<link> :
$ sudo ufw status Status: inactive
$ sudo ufw allow 22 Rules updated Rules updated (v6) $ sudo ufw allow 80 Rules updated Rules updated (v6) $ sudo ufw allow 443 Rules updated Rules updated (v6) $ sudo ufw allow 50022 Rules updated Rules updated (v6)
$ sudo ufw enable Command may disrupt existing ssh connections. Proceed with operation (y|n)? y Firewall is active and enabled on system startup
$ sudo ufw status Status: active To Action From -- ------ ---- 22 ALLOW Anywhere 80 ALLOW Anywhere 443 ALLOW Anywhere 50022 ALLOW Anywhere 22 (v6) ALLOW Anywhere (v6) 80 (v6) ALLOW Anywhere (v6) 443 (v6) ALLOW Anywhere (v6) 50022 (v6) ALLOW Anywhere (v6)
$ sudo cp /etc/systemd/timesyncd.conf /etc/systemd/timesyncd.conf.org $ ls -l /etc/systemd : -rw-r--r-- 1 root root 1003 Oct 17 2024 timesyncd.conf -rw-r--r-- 1 root root 1003 May 29 00:39 timesyncd.conf.org :
$ sudo vi /etc/systemd/timesyncd.conf
: [Time] #NTP= NTP=ntp.nict.jp 0.jp.pool.ntp.org 1.jp.pool.ntp.org 2.jp.pool.ntp.org 3.jp.pool.ntp.org :
$ sudo systemctl restart systemd-timesyncd $ sudo timedatectl status Local time: Thu 2025-05-29 09:45:50 JST Universal time: Thu 2025-05-29 00:45:50 UTC RTC time: Thu 2025-05-29 00:45:50 Time zone: Asia/Tokyo (JST, +0900) System clock synchronized: yes NTP service: active RTC in local TZ: no
Ubuntu24.04では、インストール時にサーバーをインストールできる
$ ps -ax | grep ssh 1520 ? Ss 0:00 sshd: mizutu [priv] 1575 ? S 0:00 sshd: mizutu@pts/0 16018 ? Ss 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups 16653 pts/0 S+ 0:00 grep --color=auto ssh
$ sudo apt install samba
$ sudo vi /etc/samba/smb.conf [gloval] workgroup = WORKGROUP [share] path = /var/samba/fshare read only = no browseable = yes
$ sudo mkdir -p /var/samba/fshare $ sudo chmod 777 /var/samba/fshare $ sudo pdbedit -a ユーザー名
$ sudo systemctl restart smbd nmbd
$ sudo smbstatus -d Samba version 4.19.5-Ubuntu PID Username Group Machine Protocol Version Encryption Signing ---------------------------------------------------------------------------------------------------------------------------------------- :
$ sudo apt -y install apache2
$ sudo apt -y install php-fpm $ sudo apt -y install php-dev $ sudo apt -y install php-mysql $ sudo apt -y install php-mbstring $ sudo apt -y install php-gd $ sudo apt -y install php-curl $ sudo apt -y install php-intl $ sudo apt -y install php-zip
$ sudo apt -y install mysql-server
$ apachectl -v Server version: Apache/2.4.58 (Ubuntu) Server built: 2025-04-03T14:36:49 $ mysql --version mysql Ver 8.0.42-0ubuntu0.24.04.1 for Linux on x86_64 ((Ubuntu)) $ php --version PHP 8.3.6 (cli) (built: Mar 19 2025 10:08:38) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.6, Copyright (c) Zend Technologies with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
http://サーバーIP/
$ sudo chgrp -R グループ名 /var/www $ sudo chmod g+w /var/www $ sudo chmod g+w /var/www/html
$ cd /var/www/html $ vi index.php <?php phpinfo(); ?>
$ cat index.php
http://(LinuxのIPアドレス)/index.php
$ sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.org
$ sudo vi /etc/apache2/apache2.conf <Directory /> Options FollowSymLinks # AllowOverride None AllowOverride All Require all denied </Directory> : <Directory /var/www/> # Options Indexes FollowSymLinks # AllowOverride None Options FollowSymLinks AllowOverride All Require all granted </Directory>
$ sudo /etc/init.d/apache2 restart
$ sudo apt -y install libapache2-mod-php
$ sudo vi /etc/php/7.4/apache2/php.ini extension_dir = "./" extension=mbstring post_max_size = 32M upload_max_filesize = 32M allow_url_fopen = Off [Date] ; Defines the default timezone used by the date functions ; https://php.net/date.timezone date.timezone = "Asia/Tokyo"
$ sudo service apache2 restart
http://(LinuxのIPアドレス)/index.php
ローカルコンソールからMySQLサーバに接続 $ sudo mysql -u root 状態表示 mysql> status ユーザ一覧表示 mysql> select user,host from mysql.user; データベース一覧表示 mysql> show databases; 特定のユーザーの権限確認 mysql> show grants for 'ユーザ名'@'ホスト名'; 終了 mysql> exit
新しくユーザを作成 CREATE USER 'ユーザ名'@'ホスト名' IDENTIFIED BY 'パスワード'; ユーザ名は、'ユーザ名'@'ホスト名'のように表す。ホスト名はMySQLへ接続するホスト名。サーバパソコンの場合はlocalhostとなる。ネットワークアドレスを指定する場合は192.168.1.%などのようにする。 @以下ホスト名を省略した場合は、'ユーザ名'@'%'として扱われ、どのホストからも接続できる。 ユーザ一覧を表示 mysql> SELECT user, host FROM mysql.user; 作成したユーザに権限を付与 mysql> CREATE USER文でユーザを作成した場合、初期設定では権限「なし」の状態。GRANT文を使って、権限を付与する。 mysql> GRANT [権限] ON [適用対象のデータベース].[適用対象のテーブル] TO 'ユーザ名'@'ホスト名' IDENTIFIED BY 'パスワード'; mysql> FLUSH PRIVILEGES; [権限]の部分には、設定したい権限を列挙する。[適用対象の~]には、権限を適用する対象を指定。例えば適用の単位に「データベース」を指定できる権限であれば、データベース名を指定して設定することができる。「全範囲(グローバル)」を指定したい場合は、「*.*」と指定。FLUSH PRIVILEGESを実行することで、権限の変更をデータベースに反映する。 ユーザの権限を確認する mysql> SHOW GRANTS FOR 'ユーザ名'@'ホスト名'; ユーザの権限を削除する mysql> REVOKE [権限] ON [適用対象のデータベース].[適用対象のテーブル] FROM 'ユーザ名'@'ホスト名'; mysql> FLUSH PRIVILEGES; 新規データベースの作成 mysql> CREATE DATABASE [任意のデータベース名]; データベースの削除 mysql> DROP DATABASE [任意のデータベース名];
$ sudo mysql -u root
mysql> CREATE USER 'ユーザ名'@'localhost' IDENTIFIED BY 'パスワード';
mysql> GRANT ALL ON *.* TO 'ユーザ名'@'localhost'; mysql> FLUSH PRIVILEGES;
mysql> status -------------- mysql Ver 8.0.42-0ubuntu0.24.04.1 for Linux on x86_64 ((Ubuntu)) Connection id: 8 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.42-0ubuntu0.24.04.1 (Ubuntu) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/run/mysqld/mysqld.sock Binary data as: Hexadecimal Uptime: 34 min 58 sec Threads: 2 Questions: 8 Slow queries: 0 Opens: 149 Flush tables: 3 Open tables: 68 Queries per second avg: 0.003 -------------- mysql> select user,host from mysql.user; +------------------+-----------+ | user | host | +------------------+-----------+ | debian-sys-maint | localhost | | mizutu | localhost | | mysql.infoschema | localhost | | mysql.session | localhost | | mysql.sys | localhost | | root | localhost | +------------------+-----------+ 6 rows in set (0.00 sec) mysql> exit
$ sudo apt install phpmyadmin Webサーバの種類を聞かれるので「apache2」を選択。 dbconfig-commonで設定しますか?と聞かれるので「yes」を選択。続いてMySQLサーバ上の「phpmyadmin」ユーザのパスワードを聞かれるので2回入力。
$ sudo mysql -u root : mysql> SHOW GRANTS FOR 'phpmyadmin'@'localhost'; +--------------------------------------------------------------------+ | Grants for phpmyadmin@localhost | +--------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'phpmyadmin'@'localhost' | | GRANT ALL PRIVILEGES ON `phpmyadmin`.* TO 'phpmyadmin'@'localhost' | +--------------------------------------------------------------------+ 2 rows in set (0.00 sec)
mysql> GRANT ALL ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> SHOW GRANTS FOR 'phpmyadmin'@'localhost'; +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Grants for phpmyadmin@localhost | +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `phpmyadmin`@`localhost` WITH GRANT OPTION | | GRANT APPLICATION_PASSWORD_ADMIN,AUDIT_ADMIN,BACKUP_ADMIN,BINLOG_ADMIN,BINLOG_ENCRYPTION_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,FLUSH_OPTIMIZER_COSTS,FLUSH_STATUS,FLUSH_TABLES,FLUSH_USER_RESOURCES,GROUP_REPLICATION_ADMIN,INNODB_REDO_LOG_ARCHIVE,INNODB_REDO_LOG_ENABLE,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_APPLIER,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SERVICE_CONNECTION_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,SHOW_ROUTINE,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN,TABLE_ENCRYPTION_ADMIN,XA_RECOVER_ADMIN ON *.* TO `phpmyadmin`@`localhost` WITH GRANT OPTION | | GRANT ALL PRIVILEGES ON `phpmyadmin`.* TO `phpmyadmin`@`localhost` | +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 3 rows in set (0.00 sec)
http://サーバーIP/phpmyadmin phpmyadminのIDとパッケージをインストール時に入力したパスワードでログイン。
$ sudo add-apt-repository ppa:ondrej/php PPA publishes dbgsym, you may need to include 'main/debug' component Repository: 'Types: deb : Press [ENTER] to continue or Ctrl-c to cancel. ← 'Enter' を押す :
$ sudo apt update
$ sudo apt install php7.4 php7.4-cli php7.4-fpm php7.4-mysql php7.4-xml php7.4-mbstring php7.4-curl php7.4-zip・その他のモジュールを調べる場合
$ sudo apt search php7.4-*
$ ls /usr/bin | grep -i php dh_phpcomposer dh_phppear php php7.4 php8.3 phpabtpl php-config php-config8.3 php-config.default phpize phpize8.3 phpize.default
$ sudo update-alternatives --config php There are 2 choices for the alternative php (providing /usr/bin/php). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/php8.3 83 auto mode ← 今のバージョン 1 /usr/bin/php7.4 74 manual mode ← 選択するバージョン 2 /usr/bin/php8.3 83 manual mode Press <enter> to keep the current choice[*], or type selection number: 1 update-alternatives: using /usr/bin/php7.4 to provide /usr/bin/php (php) in manual mode
$ sudo apt -y install libapache2-mod-php7.4 $ sudo /etc/init.d/apache2 restart
$ php -v PHP 7.4.33 (cli) (built: May 9 2025 06:45:02) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
$ sudo cp /etc/php/7.4/apache2/php.ini /etc/php/7.4/apache2/php.ini.org $ sudo vi /etc/php/7.4/apache2/php.ini extension_dir = "./" extension=mbstring post_max_size = 32M upload_max_filesize = 32M allow_url_fopen = Off
$ sudo service apache2 restart
http://(LinuxのIPアドレス)/index.php
$ cd /var/www/html $ sudo tar cvzf aippr_20250529.tar.gz aippr $ sudo tar cvzf pukiwiki_20250529.tar.gz pukiwiki $ sudo tar cvzf wiki-boubi_20250529.tar.gz wiki-boubi $ sudo tar cvzf wiki-diy_20250529.tar.gz wiki-diy $ sudo tar cvzf wiki-base_20230624.tar.gz wiki-base
$ cd /var/www/html $ sudo tar xvzf aippr_20250529.tar.gz $ sudo tar xvzf pukiwiki_20250529.tar.gz $ sudo tar xvzf wiki-boubi_20250529.tar.gz $ sudo tar xvzf wiki-diy_20250529.tar.gz $ sudo tar xvzf wiki-base_20230624.tar.gz
参考:IPアドレスの固定
$ ls -l /etc/netplan total 4 -rw------- 1 root root 63 May 29 08:52 50-cloud-init.yaml $ sudo cat /etc/netplan/50-cloud-init.yaml [sudo] password for mizutu: network: version: 2 ethernets: eno1: dhcp4: true
$ sudo cp /etc/netplan/50-cloud-init.yaml /etc/netplan/99-manual.yaml $ sudo mv /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.org $ sudo vi /etc/netplan/99-manual.yaml network: ethernets: eno1: dhcp4: false addresses: - 192.168.0.203/24 # IP address routes: - to: default via: 192.168.0.1 # Gateway nameservers: addresses: - 192.168.0.1 # DNS dhcp6: false version: 2※以下のネットワーク設定の記述例。
$ sudo netplan apply
$ ifconfig eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.203 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 2001:a453:6346:100:1e69:7aff:fea1:48f1 prefixlen 64 scopeid 0x0<global> inet6 fe80::1e69:7aff:fea1:48f1 prefixlen 64 scopeid 0x20<link> ether 1c:69:7a:a1:48:f1 txqueuelen 1000 (Ethernet) RX packets 22398 bytes 22918698 (22.9 MB) RX errors 0 dropped 4260 overruns 0 frame 0 TX packets 5892 bytes 487594 (487.5 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 16 memory 0x96300000-96320000 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 118 bytes 11378 (11.3 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 118 bytes 11378 (11.3 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
参考:サーバー移転(引越し)でLet’s Encrypt 「SSL/TLSサーバ証明書」はどうする?
$ sudo tar cvzf letsencrypt.tar.gz /etc/letsencrypt 旧サーバーで保存 tar: Removing leading `/' from member names /etc/letsencrypt/ /etc/letsencrypt/archive/ /etc/letsencrypt/archive/izutsu.aa0.netvolante.jp/ /etc/letsencrypt/archive/izutsu.aa0.netvolante.jp/fullchain6.pem /etc/letsencrypt/archive/izutsu.aa0.netvolante.jp/privkey22.pem :
$ sudo apt update $ sudo apt install certbot
$ cd / $ ls bin boot dev home lib lib.usr-is-merged media opt root sbin snap swap.img tmp var bin.usr-is-merged cdrom etc letsencrypt.tar.gz lib64 lost+found mnt proc run sbin.usr-is-merged srv sys usr $ sudo tar xvzf letsencrypt.tar.gz etc/letsencrypt/ etc/letsencrypt/archive/ etc/letsencrypt/archive/izutsu.aa0.netvolante.jp/ etc/letsencrypt/archive/izutsu.aa0.netvolante.jp/fullchain6.pem etc/letsencrypt/archive/izutsu.aa0.netvolante.jp/privkey22.pem :
$ sudo cp -r /etc/letsencrypt/ /etc/letsencrypt_cp/
$ sudo certbot renew --dry-run Saving debug log to /var/log/letsencrypt/letsencrypt.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Processing /etc/letsencrypt/renewal/izutsu.aa0.netvolante.jp.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Simulating renewal of an existing certificate for izutsu.aa0.netvolante.jp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations, all simulated renewals succeeded: /etc/letsencrypt/live/izutsu.aa0.netvolante.jp/fullchain.pem (success) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$ sudo crontab -e no crontab for root - using an empty one Select an editor. To change later, run 'select-editor'. 1. /bin/nano <---- easiest 2. /usr/bin/vim.basic 3. /usr/bin/vim.tiny 4. /bin/ed Choose 1-4 [1]: 2 エディタを選んで最下行に下記1行追加 0 0 * * * certbot renew :wq で書き込み終了 crontab: installing new crontab $ sudo service cron restart $ sudo ls -l /var/spool/cron/crontabs total 4 -rw------- 1 root crontab 1114 Jun 6 06:00 root
$ sudo ls -ltr /var/log/letsencrypt total 40 -rw-r--r-- 1 root root 38911 Jun 9 00:00 letsencrypt.log $ sudo cat /var/log/letsencrypt/letsencrypt.log : -----END CERTIFICATE----- 2025-06-08 14:34:13,464:DEBUG:acme.client:Storing nonce: z1TVAgOyxItjqqaoijXQc42A2Kyj_QjyU3hVwLZSEjZ_UZ5EXcc 2025-06-08 14:34:13,468:DEBUG:certbot._internal.renewal:Dry run: skipping updating lineage at /etc/letsencrypt/live/izutsu.aa0.netvolante.jp 2025-06-08 14:34:13,479:DEBUG:certbot._internal.updater:Skipping updaters in dry-run mode. 2025-06-08 14:34:13,479:DEBUG:certbot._internal.display.obj:Notifying user: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2025-06-08 14:34:13,480:DEBUG:certbot._internal.display.obj:Notifying user: Congratulations, all simulated renewals succeeded: 2025-06-08 14:34:13,480:DEBUG:certbot._internal.display.obj:Notifying user: /etc/letsencrypt/live/izutsu.aa0.netvolante.jp/fullchain.pem (success) 2025-06-08 14:34:13,480:DEBUG:certbot._internal.display.obj:Notifying user: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2025-06-08 14:34:13,480:DEBUG:certbot._internal.renewal:no renewal failures 2025-06-08 20:04:13,638:DEBUG:certbot._internal.main:certbot version: 2.9.0 2025-06-08 20:04:13,639:DEBUG:certbot._internal.main:Location of certbot entry point: /usr/bin/certbot 2025-06-08 20:04:13,639:DEBUG:certbot._internal.main:Arguments: ['-q', '--no-random-sleep-on-renew'] 2025-06-08 20:04:13,639:DEBUG:certbot._internal.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot) 2025-06-08 20:04:13,644:DEBUG:certbot._internal.log:Root logging level set at 40 2025-06-08 20:04:13,645:DEBUG:certbot._internal.display.obj:Notifying user: Processing /etc/letsencrypt/renewal/izutsu.aa0.netvolante.jp.conf 2025-06-08 20:04:13,646:DEBUG:certbot._internal.plugins.selection:Requested authenticator None and installer None 2025-06-08 20:04:13,664:INFO:certbot.ocsp:Cannot extract OCSP URI from /etc/letsencrypt/archive/izutsu.aa0.netvolante.jp/cert25.pem 2025-06-08 20:04:13,667:DEBUG:certbot._internal.display.obj:Notifying user: Certificate not yet due for renewal 2025-06-08 20:04:13,668:DEBUG:certbot._internal.plugins.selection:Requested authenticator webroot and installer None 2025-06-08 20:04:13,668:DEBUG:certbot._internal.display.obj:Notifying user: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2025-06-08 20:04:13,668:DEBUG:certbot._internal.display.obj:Notifying user: The following certificates are not due for renewal yet: 2025-06-08 20:04:13,668:DEBUG:certbot._internal.display.obj:Notifying user: /etc/letsencrypt/live/izutsu.aa0.netvolante.jp/fullchain.pem expires on 2025-08-16 (skipped) 2025-06-08 20:04:13,668:DEBUG:certbot._internal.display.obj:Notifying user: No renewals were attempted. 2025-06-08 20:04:13,668:DEBUG:certbot._internal.display.obj:Notifying user: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2025-06-08 20:04:13,668:DEBUG:certbot._internal.renewal:no renewal failures 2025-06-09 00:00:01,530:DEBUG:certbot._internal.main:certbot version: 2.9.0 2025-06-09 00:00:01,531:DEBUG:certbot._internal.main:Location of certbot entry point: /usr/bin/certbot 2025-06-09 00:00:01,531:DEBUG:certbot._internal.main:Arguments: [] 2025-06-09 00:00:01,531:DEBUG:certbot._internal.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot) 2025-06-09 00:00:01,535:DEBUG:certbot._internal.log:Root logging level set at 30 2025-06-09 00:00:01,536:DEBUG:certbot._internal.display.obj:Notifying user: Processing /etc/letsencrypt/renewal/izutsu.aa0.netvolante.jp.conf 2025-06-09 00:00:01,537:DEBUG:certbot._internal.plugins.selection:Requested authenticator None and installer None 2025-06-09 00:00:01,551:INFO:certbot.ocsp:Cannot extract OCSP URI from /etc/letsencrypt/archive/izutsu.aa0.netvolante.jp/cert25.pem 2025-06-09 00:00:01,554:DEBUG:certbot._internal.display.obj:Notifying user: Certificate not yet due for renewal 2025-06-09 00:00:01,555:DEBUG:certbot._internal.plugins.selection:Requested authenticator webroot and installer None 2025-06-09 00:00:01,555:DEBUG:certbot._internal.display.obj:Notifying user: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2025-06-09 00:00:01,555:DEBUG:certbot._internal.display.obj:Notifying user: The following certificates are not due for renewal yet: 2025-06-09 00:00:01,555:DEBUG:certbot._internal.display.obj:Notifying user: /etc/letsencrypt/live/izutsu.aa0.netvolante.jp/fullchain.pem expires on 2025-08-16 (skipped) 2025-06-09 00:00:01,555:DEBUG:certbot._internal.display.obj:Notifying user: No renewals were attempted. 2025-06-09 00:00:01,555:DEBUG:certbot._internal.display.obj:Notifying user: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2025-06-09 00:00:01,555:DEBUG:certbot._internal.renewal:no renewal failures
$ sudo a2enmod ssl
$ sudo vi /etc/apache2/sites-available/default-ssl.conf (管理者のメールアドレスへ修正) ServerAdmin = izutsum@venus.dti.ne.jp (ルートディレクトリとして公開するディレクトリのパスへ修正) DocumentRoot = /var/www/html (取得したサーバ証明書と公開鍵のパスに変更) SSLCertificateFile /etc/letsencrypt/live/izutsu.aa0.netvolante.jp/cert.pem (取得した秘密鍵のパスに変更) SSLCertificateKeyFile /etc/letsencrypt/live/izutsu.aa0.netvolante.jp/privkey.pem (コメント解除して取得した中間証明書のパスに変更) SSLCertificateChainFile /etc/letsencrypt/live/izutsu.aa0.netvolante.jp/chain.pem
$ sudo a2ensite default-ssl
$ sudo systemctl restart apache2
$ sudo ls /etc/apache2/mods-enabled access_compat.load authn_core.load authz_user.load deflate.load filter.load mpm_prefork.load php7.4.load setenvif.load status.conf alias.conf authn_file.load autoindex.conf dir.conf mime.conf negotiation.conf reqtimeout.conf socache_shmcb.load status.load alias.load authz_core.load autoindex.load dir.load mime.load negotiation.load reqtimeout.load ssl.conf auth_basic.load authz_host.load deflate.conf env.load mpm_prefork.conf php7.4.conf setenvif.conf ssl.load● mod_rewrite を有効にする
$ sudo a2enmod rewrite Enabling module rewrite. To activate the new configuration, you need to run: systemctl restart apache2● Apache2の再起動
$ sudo systemctl restart apache2● 有効化を確認する(rewrite.load を確認)
$ sudo ls /etc/apache2/mods-enabled access_compat.load authn_core.load authz_user.load deflate.load filter.load mpm_prefork.load php7.4.load setenvif.conf ssl.load alias.conf authn_file.load autoindex.conf dir.conf mime.conf negotiation.conf reqtimeout.conf setenvif.load status.conf alias.load authz_core.load autoindex.load dir.load mime.load negotiation.load reqtimeout.load socache_shmcb.load status.load auth_basic.load authz_host.load deflate.conf env.load mpm_prefork.conf php7.4.conf rewrite.load ssl.conf
$ sudo vi /etc/apache2/sites-available/000-default.conf <VirtualHost *:80> : : RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </VirtualHost>
$ sudo systemctl restart apache2
sudo apt install cockpit
$ sudo ufw allow 9090 Rule added Rule added (v6)
$ sudo ufw status Status: active To Action From -- ------ ---- 22 ALLOW Anywhere 80 ALLOW Anywhere 443 ALLOW Anywhere 50022 ALLOW Anywhere 9090 ALLOW Anywhere 22 (v6) ALLOW Anywhere (v6) 80 (v6) ALLOW Anywhere (v6) 443 (v6) ALLOW Anywhere (v6) 50022 (v6) ALLOW Anywhere (v6) 9090 (v6) ALLOW Anywhere (v6)
https://サーバー IP:9090一応問題なさそう