CentOS Linux release 8.0.1905 (Core) Minimal install with gcc related, vim, git
web
Install_and_configure_apache2.4.37
[C8LX@root ~]# dnf install httpd httpd-devel httpd-tools mod_ssl -y
[C8LX@root ~]# httpd -v
Server version: Apache/2.4.37 (centos)
Server bui lt: Oct 7 2019 21:42:02
[C8LX@root ~]# cd /etc/httpd/conf/
[C8LX@root /etc/httpd/conf]# cp httpd.conf httpd.conf.bk
[C8LX@root /etc/httpd/conf]# cat httpd.conf.bk | egrep -v "(\#|^$)" > httpd.conf
[C8LX@root /etc/httpd/conf]# vim httpd.conf
-:Listen 80
+:Listen 0.0.0.0:80
-: DirectoryIndex index.html
+: DirectoryIndex index.php index.html index.cgi
(Added at the end)
ServerTokens Prod
[C8LX@root /etc/httpd/conf]# cd
[C8LX@root ~]# firewall-cmd --list-all
services: cockpit dhcpv6-client ssh
[C8LX@root ~]# firewall-cmd --remove-service={dhcpv6-client,cockpit} --zone=public --permanent
[C8LX@root ~]# firewall-cmd --add-serevice={http,https} --zone=public --permanent
[C8LX@root ~]# firewall-cmd --reload
[C8LX@root ~]# firewall-cmd --list-all
services: http https ssh
[C8LX@root ~]# echo "test page" > /var/www/html/index.html
[C8LX@root ~]# chmod -R apache:apache /var/www
[C8LX@root ~]# systemctl start httpd
[C8LX@root ~]# systemctl enable httpd
Access http: // server IP / with a browser, and if it is displayed, it is OK.
PHP
Install_and_configure_php7.2.11
[C8LX@root ~]# dnf install php php-fpm php-mbstring \
php-devel php-mysqlnd -y
[C8LX@root ~]# php -v
PHP 7.2.11 (cli) (built: Oct 9 2018 15:09:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
[C8LX@root ~]# vim /etc/php.ini
-:;date.timezone =
+:date.timezone = Asia/Tokyo
-:expose_php = On
+:expose_php = Off
-:;mbstring.language = Japanese
+:mbstring.language = Japanese
-:;mbstring.internal_encoding =
+:mbstring.internal_encoding = UTF-8
-:;mbstring.http_input =
+:mbstring.http_input = UTF-8
-:;mbstring.http_output =
+:mbstring.http_output = UTF-8
-:;mbstring.encoding_translation = Off
+:mbstring.encoding_translation = On
-:;mbstring.detect_order = auto
+:mbstring.detect_order = auto
-:;mbstring.substitute_character = none
+:mbstring.substitute_character = none
[C8LX@root ~]# echo -n '<?php\nphpinfo();\n?>' > /var/www/html/index.php
[C8LX@root ~]# cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.bk
[C8LX@root ~]# vim /etc/php-fpm.d/www.conf
-:;listen.owner = nobody
+:listen.owner = apache
-:;listen.group = nobody
+:listen.group = apache
-:;listen.mode = 0660
+:listen.mode = 0660
[C8LX@root ~]# systemctl restart httpd
Access http: // server IP / index.php with a browser, and if phpinfo () is displayed, it's OK.
mysql
Install_and_configure_mysql8.0
[C8LX@root ~]# dnf install mysql-server mysql-devel -y
[C8LX@root ~]# vim /etc/my.cnf.d/mysql-server.cnf
(Added at the end)
+:character-set-server=utf8
+:bind-address=0.0.0.0
#+:collation-server=utf8_unicode_ci
[C8LX@root ~]# vim /etc/my.cnf
([client]Added directly below)
+:default-character-set=utf8
+:[mysql]
+:default-character-set=utf8
[C8LX@root ~]# cp /usr/lib/systemd/system/mysqld.service \
/etc/systemd/system/
[C8LX@root ~]# vim /etc/systemd/system/mysqld.service
-:ExecStart=/usr/libexec/mysqld --basedir=/usr
+:ExecStart=/usr/libexec/mysqld --basedir=/usr --skip-mysqlx
[C8LX@root ~]# systemctl daemon-reload
[C8LX@root ~]# systemctl start mysqld.service
[C8LX@root ~]# systemctl status mysqld.service
Active: active (running)
[C8LX@root ~]# netstat -ant
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
[C8LX@root ~]# mysql -u root
(* Uppercase letters below are optional)
mysql> create database DBNAME;
mysql> create user USERNAME@localhost;
mysql> grant all privileges on DBNAME.* to USERNAME@localhost;
mysql> alter user USERNAME@localhost identified by 'PASSWORD';
mysql> quit;
[C8LX@root ~]# vim test.php
<?php
try {
$dbcon = new PDO('mysql:host=localhost;dbname=DBNAME','USERNAME','PASSWORD');
printf("success\n");
}
catch(PDOException $e){
printf("failure\n");
exit;
}
?>
[C8LX@root ~]# php test.php
success
[C8LX@root ~]# firewall-cmd --add-service=mysql --zone=public --permanent
[C8LX@root ~]# firewall-cmd --reload
[C8LX@root ~]# firewall-cmd --list-all
services: http https mysql ntp samba samba-client ssh
So far for the time being. I'm not good at SQL so I always search I wonder why it is often all capitalized.
Recommended Posts