#SELinuxを無効化しアップデート
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled #変更
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
dnf -y update
必要な設定をインストール
sudo vi 0S8LAMPPJ.sh
#apache:php:mysqlインストール
dnf install -y vim
dnf remove -y php
dnf remove -y mariadb
dnf -y install epel-release
dnf -y update epel-release
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
rpm --import http://rpms.remirepo.net/RPM-GPG-KEY-remi
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf -y install dnf-utils
sudo dnf module install php:remi-7.4
rpm --import http://rpms.remirepo.net/RPM-GPG-KEY-remi
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
dnf config-manager --set-enabled remi
dnf -y install wget
dnf -y install vim-enhanced
dnf -y install git
dnf -y install unzip
dnf -y install module php:remi-8.0
dnf -y install php-cli php-devel php-common php-mbstring php-fpm php-gd php-opcache php-pdo php-xml php-intl php-zip php-pear php-bcmath
dnf -y install php-mysqlnd
dnf -y install mod_ssl
dnf -y install php php-devel php-mysqlnd php-gd php-pear php-pecl-apc-devel php-pecl-zip php-gd php-zip php-mysqlnd
dnf -y install httpd httpd-tools httpd-devel httpd-manual
dnf -y update
#開発ツールなど、基本的なパッケージをインストールしておきます。
dnf -y groupinstall base
dnf -y groupinstall development
#Python3系インストールコマンド
dnf -y install python3
#Djangoのインストールにはpip3を使用します。
dnf -y install pip
#Djangoのインストール
pip3 -y install django
#jsの設定です。
dnf install -y nodejs npm
dnf npm install n -g
dnf install npm
dnf n stable
dnf install nodejs
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
dnf module reset nodejs
sudo dnf module reset nodejs
sudo dnf module enable nodejs:16
sudo dnf module -y install nodejs:16/common
node -v
npm install && npm run dev
source ~/.bashrc
#java
yum install java-11-openjdk
yum install java-11-openjdk-devel
yum install java-11-openjdk-headless
sysctl -w net.ipv6.conf.all.disable_ipv6=1
wget https://getcomposer.org/installer -O composer-installer.php
php composer-installer.php --filename=composer --install-dir=/usr/local/bin
composer self-update
sudo chmod u+x 0S8LAMPPJ.sh
sudo ./0S8LAMPPJ.sh
#インストールされているか確認
dnf list --installed | grep httpd
systemctl start httpd
#Apacheを起動できているか確認
systemctl status httpd
systemctl enable httpd
#自動起動を有効にファイアウォールの設定をする
firewall-cmd --add-service=http --zone=public --permanent
firewall-cmd --reload
#servicesにhttpが追加されているか確認
firewall-cmd --list-all
mysql
dnf localinstall https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
dnf repolist enabled | grep "mysql.*-community.*"
dnf module disable mysql
dnf info mysql-community-server
dnf install mysql-community-server
#以下のコマンドでMySQLがインストールされていることを確認します。
mysqld --version
パスワード確認
# cat /var/log/mysqld.log | grep password
2019-12-13T06:12:17.402781Z 1 [Note] A temporary password is generated for root@localhost: <初期パスワード>
[root@centos8 ~]# mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
New password:
Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
sudo mysql -u root -p
パスワード入力
mysql> CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
mysql>flush privileges;
mysql>exit
#mysql起動
systemctl start mysqld
#パスワード確認
cat /var/log/mysqld.log | grep password
2019-12-13T06:12:17.402781Z 1 [Note] A temporary password is generated for root@localhost: <初期パスワード>
#mysql自動起動設定(再起動してから自動起動有効化)
systemctl restart mysqld
systemctl enable mysqld