Centos&amazonlinux2 LAMPPJ


必要な設定をインストール

sudo vi 0S8LAMPPJ.sh
以下を貼り付け
```
#update後apache:php:mysqlインストール
dnf -y update
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
wget https://getcomposer.org/installer -O composer-installer.php
php composer-installer.php --filename=composer --install-dir=/usr/local/bin
composer self-update



#開発ツールなど、基本的なパッケージをインストールしておきます。
dnf -y groupinstall base
dnf -y groupinstall development

#Python３系インストールコマンド
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
dnf module reset nodejs
dnf module enable nodejs:16
dnf module -y install nodejs:16/common
node -v
source ~/.bashrc

#java
dnf install java-11-openjdk
dnf install java-11-openjdk-devel
dnf install java-11-openjdk-headless


#インストールされているか確認
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
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
dnf repolist enabled | grep "mysql.*-community.*"
dnf module disable mysql
dnf info mysql-community-server
dnf install -y mysql-community-server

```
以下手動で実行。
sudo chmod u+x 0S8LAMPPJ.sh
sudo ./0S8LAMPPJ.sh

上記スクリプト実行後は全てYで対応お願いします

mysqlの設定は手動でお願いします
```
#パスワード確認
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

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

```