これまでの作業で CentOS 8 の仮想マシンがインストールできたので,CentOS を利用する準備ができました.しかし,Web サーバやその他の開発環境などが一切インストールされていないので,ここでは各種のソフトウェアのインストールと設定を行います.ただ,一つひとつソフトウェアをインストールするのは大変な作業です.よって,ここでは,必要なソフトウェアを自動的にインストール・設定するための Ansible を使うことにします.
Ansible による自動インストールのスクリプトファイルを GitHub から Windows にダウンロードし,ダウンロードしたファイルを Cyberduck を使って仮想マシンにアップロードする.(Github のユーザ登録が完了して,公開鍵を Github に登録している場合は,git clone
コマンドでも可能です.)
GitHub の https://github.com/rinsaka/centos8ansible を開く.「Code」から「Download ZIP」をクリックし,ZIP 形式でローカルの Windows PC にダウンロードする.
ダウンロードした ZIP ファイルを右クリックして「すべて展開」する.
展開先は適当な場所でよい.
次は,Cyberduck を使って,仮想マシンのホームフォルダ 「/home/vagrant/」にアップロードする.Windows のエクスプローラからフォルダごとドラッグ&ドロップすれば良い.
アップロードできれば次のような画面が表示される.この画面は閉じて良い.
仮想マシンの「/home/vagrant/」以下にフォルダごとコピーされた.
ここからはコマンドプロンプトで作業する.Ansible のスクリプトがコピーされたので,そのフォルダに移動する.
C:\Users\Rinsaka\MyVagrant\MyCentOS>vagrant ssh ⏎ Last login: Fri Mar 26 00:40:20 2021 from 10.0.2.2 [vagrant@centos8 ~]$ pwd ⏎ /home/vagrant [vagrant@centos8 ~]$ ls ⏎ centos8ansible-master [vagrant@centos8 ~]$ cd centos8ansible-master/ ⏎ [vagrant@centos8 centos8ansible-master]$ ls ⏎ 00-sshd.yml 05-mariadb.yml 08-ruby.yml 11-siege.yml main.yml run.sh 01-apache.yml 06-php.yml 09-python-anaconda.yml 12-mongo.yml mongodb-org.repo sshd_config.custom 04-mecab.yml 07-laravel.yml 10-pdftotext.yml bash_profile.custom README.md work [vagrant@centos8 centos8ansible-master]
コピーされたファイルの一つ,run.sh には実行権限が付与されていないので(Windows上でZIPファイルを展開したため),chmod
コマンドで実行権限を付与する.(ファイルの属性が -rw-rw-r-- ではなく -rwxrwx--- になるように x (eXecutable) のフラグを立てる.Github から git clone をした場合は実行権限がついているはずです.)
[vagrant@centos8 centos8ansible-master]$ ls -l ⏎ total 72 -rw-rw-r--. 1 vagrant vagrant 337 Mar 26 00:49 00-sshd.yml -rw-rw-r--. 1 vagrant vagrant 341 Mar 26 00:49 01-apache.yml -rw-rw-r--. 1 vagrant vagrant 2351 Mar 26 00:49 04-mecab.yml -rw-rw-r--. 1 vagrant vagrant 391 Mar 26 00:49 05-mariadb.yml -rw-rw-r--. 1 vagrant vagrant 955 Mar 26 00:49 06-php.yml -rw-rw-r--. 1 vagrant vagrant 934 Mar 26 00:49 07-laravel.yml -rw-rw-r--. 1 vagrant vagrant 3032 Mar 26 00:49 08-ruby.yml -rw-rw-r--. 1 vagrant vagrant 1343 Mar 26 00:49 09-python-anaconda.yml -rw-rw-r--. 1 vagrant vagrant 381 Mar 26 00:49 10-pdftotext.yml -rw-rw-r--. 1 vagrant vagrant 247 Mar 26 00:49 11-siege.yml -rw-rw-r--. 1 vagrant vagrant 372 Mar 26 00:49 12-mongo.yml -rw-rw-r--. 1 vagrant vagrant 374 Mar 26 00:49 bash_profile.custom -rw-rw-r--. 1 vagrant vagrant 1191 Mar 26 00:49 main.yml -rw-rw-r--. 1 vagrant vagrant 200 Mar 26 00:49 mongodb-org.repo -rw-rw-r--. 1 vagrant vagrant 549 Mar 26 00:49 README.md -rw-rw-r--. 1 vagrant vagrant 729 Mar 26 00:49 run.sh -rw-rw-r--. 1 vagrant vagrant 4270 Mar 26 00:49 sshd_config.custom drwxrwxr-x. 2 vagrant vagrant 6 Mar 26 00:49 work [vagrant@centos8 centos8ansible-master]$ chmod 770 run.sh ⏎ [vagrant@centos8 centos8ansible-master]$ ls -l ⏎ total 72 -rw-rw-r--. 1 vagrant vagrant 337 Mar 26 00:49 00-sshd.yml -rw-rw-r--. 1 vagrant vagrant 341 Mar 26 00:49 01-apache.yml -rw-rw-r--. 1 vagrant vagrant 2351 Mar 26 00:49 04-mecab.yml -rw-rw-r--. 1 vagrant vagrant 391 Mar 26 00:49 05-mariadb.yml -rw-rw-r--. 1 vagrant vagrant 955 Mar 26 00:49 06-php.yml -rw-rw-r--. 1 vagrant vagrant 934 Mar 26 00:49 07-laravel.yml -rw-rw-r--. 1 vagrant vagrant 3032 Mar 26 00:49 08-ruby.yml -rw-rw-r--. 1 vagrant vagrant 1343 Mar 26 00:49 09-python-anaconda.yml -rw-rw-r--. 1 vagrant vagrant 381 Mar 26 00:49 10-pdftotext.yml -rw-rw-r--. 1 vagrant vagrant 247 Mar 26 00:49 11-siege.yml -rw-rw-r--. 1 vagrant vagrant 372 Mar 26 00:49 12-mongo.yml -rw-rw-r--. 1 vagrant vagrant 374 Mar 26 00:49 bash_profile.custom -rw-rw-r--. 1 vagrant vagrant 1191 Mar 26 00:49 main.yml -rw-rw-r--. 1 vagrant vagrant 200 Mar 26 00:49 mongodb-org.repo -rw-rw-r--. 1 vagrant vagrant 549 Mar 26 00:49 README.md -rwxrwx---. 1 vagrant vagrant 729 Mar 26 00:49 run.sh -rw-rw-r--. 1 vagrant vagrant 4270 Mar 26 00:49 sshd_config.custom drwxrwxr-x. 2 vagrant vagrant 6 Mar 26 00:49 work [vagrant@centos8 centos8ansible-master]$
自動インストールの準備が整ったので,./run.sh
を実行する.なおこの処理にはかなりの時間(20分またはそれ以上)を要します.
[vagrant@centos8 centos8ansible-master]$ ./run.sh ⏎ which: no ansible-playbook in (/home/vagrant/.local/bin:/home/vagrant/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin) Last metadata expiration check: 0:07:34 ago on Fri 26 Mar 2021 12:43:54 AM UTC. Package epel-release-8-10.el8.noarch is already installed. Dependencies resolved. Nothing to do. Complete! Last metadata expiration check: 0:07:35 ago on Fri 26 Mar 2021 12:43:54 AM UTC. Dependencies resolved. ======================================================================================================================== Package Architecture Version Repository Size ======================================================================================================================== Installing: ansible noarch 2.9.18-1.el8 epel 17 M Installing dependencies: libsodium x86_64 1.0.18-2.el8 epel 162 k python3-asn1crypto noarch 0.24.0-3.el8 baseos 181 k python3-babel noarch 2.5.1-5.el8 appstream 4.8 M python3-bcrypt x86_64 3.1.6-2.el8.1 epel 44 k python3-cffi x86_64 1.11.5-5.el8 baseos 237 k python3-cryptography x86_64 2.3-3.el8 baseos 510 k python3-idna noarch 2.5-5.el8 baseos 97 k python3-jinja2 noarch 2.10.1-2.el8_0 appstream 538 k python3-jmespath noarch 0.9.0-11.el8 appstream 45 k python3-markupsafe x86_64 0.23-19.el8 appstream 39 k python3-pyasn1 noarch 0.3.7-6.el8 appstream 126 k python3-pycparser noarch 2.14-14.el8 baseos 109 k python3-pynacl x86_64 1.3.0-5.el8 epel 100 k python3-pytz noarch 2017.2-9.el8 appstream 54 k python3-pyyaml x86_64 3.12-12.el8 baseos 193 k sshpass x86_64 1.06-9.el8 epel 27 k Installing weak dependencies: python3-paramiko noarch 2.4.3-1.el8 epel 289 k Transaction Summary ======================================================================================================================== Install 18 Packages Total download size: 25 M Installed size: 129 M Downloading Packages: (1/18): python3-jmespath-0.9.0-11.el8.noarch.rpm 22 kB/s | 45 kB 00:02 (2/18): python3-markupsafe-0.23-19.el8.x86_64.rpm 121 kB/s | 39 kB 00:00 (3/18): python3-pyasn1-0.3.7-6.el8.noarch.rpm 197 kB/s | 126 kB 00:00 (4/18): python3-pytz-2017.2-9.el8.noarch.rpm 157 kB/s | 54 kB 00:00 (5/18): python3-jinja2-2.10.1-2.el8_0.noarch.rpm 158 kB/s | 538 kB 00:03 (6/18): python3-cffi-1.11.5-5.el8.x86_64.rpm 651 kB/s | 237 kB 00:00 (7/18): python3-asn1crypto-0.24.0-3.el8.noarch.rpm 276 kB/s | 181 kB 00:00 (8/18): python3-idna-2.5-5.el8.noarch.rpm 289 kB/s | 97 kB 00:00 (9/18): python3-cryptography-2.3-3.el8.x86_64.rpm 745 kB/s | 510 kB 00:00 (10/18): python3-pycparser-2.14-14.el8.noarch.rpm 334 kB/s | 109 kB 00:00 (11/18): python3-pyyaml-3.12-12.el8.x86_64.rpm 541 kB/s | 193 kB 00:00 (12/18): libsodium-1.0.18-2.el8.x86_64.rpm 608 kB/s | 162 kB 00:00 (13/18): python3-bcrypt-3.1.6-2.el8.1.x86_64.rpm 253 kB/s | 44 kB 00:00 (14/18): python3-paramiko-2.4.3-1.el8.noarch.rpm 1.2 MB/s | 289 kB 00:00 (15/18): python3-pynacl-1.3.0-5.el8.x86_64.rpm 1.9 MB/s | 100 kB 00:00 (16/18): sshpass-1.06-9.el8.x86_64.rpm 615 kB/s | 27 kB 00:00 (17/18): ansible-2.9.18-1.el8.noarch.rpm 12 MB/s | 17 MB 00:01 (18/18): python3-babel-2.5.1-5.el8.noarch.rpm 664 kB/s | 4.8 MB 00:07 ------------------------------------------------------------------------------------------------------------------------ Total 2.8 MB/s | 25 MB 00:08 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : sshpass-1.06-9.el8.x86_64 1/18 Installing : libsodium-1.0.18-2.el8.x86_64 2/18 Installing : python3-pyyaml-3.12-12.el8.x86_64 3/18 Installing : python3-pycparser-2.14-14.el8.noarch 4/18 Installing : python3-cffi-1.11.5-5.el8.x86_64 5/18 Installing : python3-bcrypt-3.1.6-2.el8.1.x86_64 6/18 Installing : python3-pynacl-1.3.0-5.el8.x86_64 7/18 Installing : python3-idna-2.5-5.el8.noarch 8/18 Installing : python3-asn1crypto-0.24.0-3.el8.noarch 9/18 Installing : python3-cryptography-2.3-3.el8.x86_64 10/18 Installing : python3-pytz-2017.2-9.el8.noarch 11/18 Installing : python3-babel-2.5.1-5.el8.noarch 12/18 Installing : python3-pyasn1-0.3.7-6.el8.noarch 13/18 Installing : python3-paramiko-2.4.3-1.el8.noarch 14/18 Installing : python3-markupsafe-0.23-19.el8.x86_64 15/18 Installing : python3-jinja2-2.10.1-2.el8_0.noarch 16/18 Installing : python3-jmespath-0.9.0-11.el8.noarch 17/18 Installing : ansible-2.9.18-1.el8.noarch 18/18 Running scriptlet: ansible-2.9.18-1.el8.noarch 18/18 Verifying : python3-babel-2.5.1-5.el8.noarch 1/18 Verifying : python3-jinja2-2.10.1-2.el8_0.noarch 2/18 Verifying : python3-jmespath-0.9.0-11.el8.noarch 3/18 Verifying : python3-markupsafe-0.23-19.el8.x86_64 4/18 Verifying : python3-pyasn1-0.3.7-6.el8.noarch 5/18 Verifying : python3-pytz-2017.2-9.el8.noarch 6/18 Verifying : python3-asn1crypto-0.24.0-3.el8.noarch 7/18 Verifying : python3-cffi-1.11.5-5.el8.x86_64 8/18 Verifying : python3-cryptography-2.3-3.el8.x86_64 9/18 Verifying : python3-idna-2.5-5.el8.noarch 10/18 Verifying : python3-pycparser-2.14-14.el8.noarch 11/18 Verifying : python3-pyyaml-3.12-12.el8.x86_64 12/18 Verifying : ansible-2.9.18-1.el8.noarch 13/18 Verifying : libsodium-1.0.18-2.el8.x86_64 14/18 Verifying : python3-bcrypt-3.1.6-2.el8.1.x86_64 15/18 Verifying : python3-paramiko-2.4.3-1.el8.noarch 16/18 Verifying : python3-pynacl-1.3.0-5.el8.x86_64 17/18 Verifying : sshpass-1.06-9.el8.x86_64 18/18 Installed: ansible-2.9.18-1.el8.noarch libsodium-1.0.18-2.el8.x86_64 python3-asn1crypto-0.24.0-3.el8.noarch python3-babel-2.5.1-5.el8.noarch python3-bcrypt-3.1.6-2.el8.1.x86_64 python3-cffi-1.11.5-5.el8.x86_64 python3-cryptography-2.3-3.el8.x86_64 python3-idna-2.5-5.el8.noarch python3-jinja2-2.10.1-2.el8_0.noarch python3-jmespath-0.9.0-11.el8.noarch python3-markupsafe-0.23-19.el8.x86_64 python3-paramiko-2.4.3-1.el8.noarch python3-pyasn1-0.3.7-6.el8.noarch python3-pycparser-2.14-14.el8.noarch python3-pynacl-1.3.0-5.el8.x86_64 python3-pytz-2017.2-9.el8.noarch python3-pyyaml-3.12-12.el8.x86_64 sshpass-1.06-9.el8.x86_64 Complete! Last metadata expiration check: 0:08:03 ago on Fri 26 Mar 2021 12:43:54 AM UTC. Dependencies resolved. Nothing to do. Complete! [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [install python3-libselinux] ************************************************************************************** ok: [localhost] TASK [Disabled SELinux] ************************************************************************************************ [WARNING]: SELinux state temporarily changed from 'enforcing' to 'permissive'. State change will take effect next reboot. changed: [localhost] TASK [remove firewall] ************************************************************************************************* changed: [localhost] TASK [remove localtime] ************************************************************************************************ changed: [localhost] TASK [change timezone] ************************************************************************************************* changed: [localhost] TASK [install chrony] ************************************************************************************************** ok: [localhost] TASK [change /etc/adjtime] ********************************************************************************************* changed: [localhost] TASK [install man] ***************************************************************************************************** ok: [localhost] TASK [install patch] *************************************************************************************************** ok: [localhost] TASK [install gcc] ***************************************************************************************************** ok: [localhost] TASK [install gcc-c++] ************************************************************************************************* ok: [localhost] TASK [install unzip] *************************************************************************************************** changed: [localhost] TASK [langpacks-ja] **************************************************************************************************** changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=14 changed=7 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [install apache] ************************************************************************************************** changed: [localhost] TASK [start apache and enabled] **************************************************************************************** changed: [localhost] TASK [change owner] **************************************************************************************************** changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [download mecab.tar.gz] ******************************************************************************************* changed: [localhost] TASK [unarchive mecab.tar.gz] ****************************************************************************************** changed: [localhost] TASK [configure mecab] ************************************************************************************************* changed: [localhost] TASK [make mecab] ****************************************************************************************************** changed: [localhost] TASK [make install mecab] ********************************************************************************************** changed: [localhost] TASK [delete mecab source dir] ***************************************************************************************** changed: [localhost] TASK [delete mecab source file] **************************************************************************************** changed: [localhost] TASK [download ipadic.tar.gz] ****************************************************************************************** changed: [localhost] TASK [unarchive ipadic.tar.gz] ***************************************************************************************** changed: [localhost] TASK [configure ipadic] ************************************************************************************************ changed: [localhost] TASK [make ipadic] ***************************************************************************************************** changed: [localhost] TASK [make install ipadic] ********************************************************************************************* changed: [localhost] TASK [delete ipadic source dir] **************************************************************************************** changed: [localhost] TASK [delete ipadic source file] *************************************************************************************** changed: [localhost] TASK [download mecab-ipadic-neologd] *********************************************************************************** changed: [localhost] TASK [install NEologd] ************************************************************************************************* changed: [localhost] TASK [delete NEologd dir] ********************************************************************************************** changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=18 changed=17 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [install mariadb] ************************************************************************************************* changed: [localhost] TASK [start mariadb and enabled] *************************************************************************************** changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [install remi repository] ***************************************************************************************** [WARNING]: Consider using the yum, dnf or zypper module rather than running 'rpm'. If you need to use command because yum, dnf or zypper is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid of this message. changed: [localhost] TASK [install php] ***************************************************************************************************** changed: [localhost] TASK [update-alternatives] ********************************************************************************************* changed: [localhost] TASK [restart httpd] *************************************************************************************************** changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=5 changed=4 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [create documents directory] ************************************************************************************** changed: [localhost] TASK [create documents/laravel directory] ****************************************************************************** changed: [localhost] TASK [download composer] *********************************************************************************************** changed: [localhost] TASK [setup composer] ************************************************************************************************** changed: [localhost] TASK [unlink composer-setup] ******************************************************************************************* changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=6 changed=5 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [install ruby dependencies] *************************************************************************************** changed: [localhost] TASK [check rbenv installed] ******************************************************************************************* changed: [localhost] TASK [git clone rbenv] ************************************************************************************************* changed: [localhost] TASK [update bash_profile] ********************************************************************************************* changed: [localhost] TASK [check ruby-build installed] ************************************************************************************** changed: [localhost] TASK [git clone ruby-build] ******************************************************************************************** changed: [localhost] TASK [update rbenv] **************************************************************************************************** changed: [localhost] TASK [update ruby-build] *********************************************************************************************** changed: [localhost] TASK [check ruby installed] ******************************************************************************************** changed: [localhost] TASK [install ruby] **************************************************************************************************** changed: [localhost] TASK [install nodejs] ************************************************************************************************** changed: [localhost] TASK [install npm] ***************************************************************************************************** ok: [localhost] TASK [install n] ******************************************************************************************************* changed: [localhost] TASK [insall stable nodejs and npm by n] ******************************************************************************* changed: [localhost] TASK [remove previous nodejs] ****************************************************************************************** changed: [localhost] TASK [remove previous npm] ********************************************************************************************* ok: [localhost] TASK [install yarn.repo] *********************************************************************************************** changed: [localhost] TASK [install yarn] **************************************************************************************************** changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=19 changed=16 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [git clone pyenv] ************************************************************************************************* changed: [localhost] TASK [edit .bashrc (1)] ************************************************************************************************ changed: [localhost] TASK [edit .bashrc (2)] ************************************************************************************************ changed: [localhost] TASK [edit .bashrc (3)] ************************************************************************************************ changed: [localhost] TASK [Install Anaconda] ************************************************************************************************ changed: [localhost] TASK [Rehash] ********************************************************************************************************** changed: [localhost] TASK [Set Global] ****************************************************************************************************** changed: [localhost] TASK [edit .bashrc] **************************************************************************************************** changed: [localhost] TASK [Source] ********************************************************************************************************** changed: [localhost] TASK [Update Conda] **************************************************************************************************** changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=11 changed=10 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [install poppler] ************************************************************************************************* changed: [localhost] TASK [install poppler-utils] ******************************************************************************************* changed: [localhost] TASK [install ghostscript] ********************************************************************************************* changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [install siege] *************************************************************************************************** changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************* TASK [Gathering Facts] ************************************************************************************************* ok: [localhost] TASK [copy mongo.repo] ************************************************************************************************* changed: [localhost] TASK [install mongodb-org] ********************************************************************************************* changed: [localhost] TASK [start mongod] **************************************************************************************************** changed: [localhost] PLAY RECAP ************************************************************************************************************* localhost : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 [vagrant@centos8 centos8ansible-master]$
設定した内容を反映させるコマンドも入力する.(または一旦ログアウトしてログインしなおす.)
[vagrant@centos8 centos8ansible-master]$ exec $SHELL -l ⏎ [vagrant@centos8 centos8ansible-master]$
MongoDB を使う場合は,管理者パスワードを(hogehoge
の部分を適当に変更して)設定しておくと良い.
[vagrant@centos8 centos8ansible-master]$ mongo ⏎ MongoDB shell version v4.4.4 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("5972c49b-592b-4a3f-8609-2d4afa20cd14") } MongoDB server version: 4.4.4 Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see https://docs.mongodb.com/ Questions? Try the MongoDB Developer Community Forums https://community.mongodb.com --- The server generated these startup warnings when booting: 2021-03-26T10:09:59.318+09:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted 2021-03-26T10:09:59.318+09:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never' --- --- Enable MongoDB's free cloud-based monitoring service, which will then receive and display metrics about your deployment (disk utilization, CPU, operation statistics, etc). The monitoring data will be available on a MongoDB website with a unique URL accessible to you and anyone you share the URL with. MongoDB may use this information to make product improvements and to suggest MongoDB products and deployment options to you. To enable free monitoring, run the following command: db.enableFreeMonitoring() To permanently disable this reminder, run the following command: db.disableFreeMonitoring() --- > use admin ⏎ switched to db admin > db.createUser({user:"root", pwd:"hogehoge", roles:["root"]}) ⏎ Successfully added user: { "user" : "root", "roles" : [ "root" ] } > quit() ⏎ [vagrant@centos8 centos8ansible-master]$
なお,MySQL (MariaDB) を使う場合はここで管理者パスワードを設定しておく.なお,初期パスワードが設定されていないので,Enterを押すだけです.
[vagrant@centos8 centos8ansible-master]$ sudo mysql_secure_installation ⏎ NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): ⏎ # Enter を押すだけ OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] y ⏎ New password: # 管理者パスワードを設定 Re-enter new password: # 管理者パスワードを再入力 Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB 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? [Y/n] y ⏎ ... Success! 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? [Y/n] y ⏎ ... Success! By default, MariaDB 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? [Y/n] y ⏎ - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ⏎ ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB! [vagrant@centos8 centos8ansible-master]$
この作業によって,Apache(Web サーバ),MySQL(データベースサーバ)などのサーバや,PHP,Laravel,Ruby,Python などの開発環境,Mecab(日本語の形態素解析)などがインストールされた.
ここでの作業でインストールされた主なソフトウェアのパスとバージョンを確認しておく.
[vagrant@centos8 ~]$ which python ⏎ ~/.pyenv/versions/anaconda3-2020.11/bin/python [vagrant@centos8 ~]$ python --version ⏎ Python 3.8.5 [vagrant@centos8 ~]$ which ruby ⏎ ~/.rbenv/shims/ruby [vagrant@centos8 ~]$ ruby --version ⏎ ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux] [vagrant@centos8 ~]$ which php ⏎ /usr/bin/php [vagrant@centos8 ~]$ php --version ⏎ PHP 8.0.3 (cli) (built: Mar 2 2021 16:37:06) ( NTS gcc x86_64 ) Copyright (c) The PHP Group Zend Engine v4.0.3, Copyright (c) Zend Technologies with Xdebug v3.0.3, Copyright (c) 2002-2021, by Derick Rethans [vagrant@centos8 ~]$ which mongo ⏎ /usr/bin/mongo [vagrant@centos8 ~]$ mongo --version ⏎ MongoDB shell version v4.4.4 Build Info: { "version": "4.4.4", "gitVersion": "8db30a63db1a9d84bdcad0c83369623f708e0397", "openSSLVersion": "OpenSSL 1.1.1g FIPS 21 Apr 2020", "modules": [], "allocator": "tcmalloc", "environment": { "distmod": "rhel80", "distarch": "x86_64", "target_arch": "x86_64" } } [vagrant@centos8 ~]$ which mysql ⏎ /usr/bin/mysql [vagrant@centos8 ~]$ mysql --version ⏎ mysql Ver 15.1 Distrib 10.3.27-MariaDB, for Linux (x86_64) using readline 5.1 [vagrant@centos8 ~]$ which mecab ⏎ /usr/local/bin/mecab [vagrant@centos8 ~]$ mecab --version ⏎ mecab of 0.996 [vagrant@centos8 ~]$