規格
OS:CentOS 7 (64bit)Apache:2.4.6
MariaDB:5.5.47
PHP:5.4.16
phpMyAdmin:4.4.15.6
Linux
更新並安裝基礎工具yum -y update
yum -y install firewalld net-tools vim wget bzip2 unzip
systemctl start firewalld
systemctl enable firewalld
Apahce
yum -y install httpdMariaDB
yum -y install mariadb-server mariadbsystemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
設定資料庫步驟
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS 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.
//詢問是否要設定root密碼
Set root password? [Y/n] y
New password:[Password]
Re-enter new password:[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.
//詢問是否要關閉root遠端登入
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!
PHP
yum -y install php php-mysqlnd php-gb php-mbstringsystemctl start httpd
systemctl enable httpd
phpMyAdmin
官方網站:https://www.phpmyadmin.net/
wget https://files.phpmyadmin.net/phpMyAdmin/4.4.15.6/phpMyAdmin-4.4.15.6-all-languages.tar.bz2
wget https://files.phpmyadmin.net/phpMyAdmin/4.4.15.6/phpMyAdmin-4.4.15.6-all-languages.tar.bz2
tar -xv -f ./phpMyAdmin-4.4.15.6-all-languages.tar.bz2
mv phpMyAdmin-4.4.15.6-all-languages phpMyAdmin
mv phpMyAdmin /var/www/html/
chown -R root. /var/www/html/phpMyAdmin
chcon -R -t httpd_sys_content_t /var/www/html/phpMyAdmin
cp /var/www/html/phpMyAdmin/config.sample.inc.php /var/www/html/phpMyAdmin/config.inc.php
vim /var/www/html/phpMyAdmin/config.inc.php
修改第17行
$cfg['blowfish_secret'] = '[隨意打入一段亂碼]';
修改第29行
$cfg['Servers'][$i]['auth_type'] = 'http';
沒有留言:
張貼留言