Установка RackTables на CentOS Stream 9
Отредактирована 11.12.2024
- Выполнить сетевые настройки, чтобы сам host был доступен по ip адресу, в примере будет использоваться ip 10.10.10.5/24, возможно вы его настроили при установке OS.
# nano /etc/hostname
# systemctl reboot
# hostname ; hostname -I ; cat /etc/redhat-release
RackTables
10.10.10.5
CentOS Stream release 9
Шаг 1. Настройте firewall
# systemctl status firewalld.service
# firewall-cmd --get-default-zone
public
# firewall-cmd --get-active-zones
public
interfaces: enp0s3
# firewall-cmd --permanent --zone=public --add-service=http
success
# firewall-cmd --permanent --zone=public --add-port=80/tcp
success
# firewall-cmd --reload
success
# firewall-cmd --list-all
Шаг 2. Установка пакета httpd
# rpm -qa | grep httpd
# dnf -y install httpd
# systemctl status httpd.service
# systemctl start httpd.service
# systemctl enable httpd.service
# systemctl status httpd.service
# rm -f /etc/httpd/conf.d/welcome.conf
дерективу ServerName 10.10.10.5:80
# ServerName www.exampl.com:80
ServerName 10.10.10.5:80
# netstat -tulpn | grep 80
Шаг 3. Установка PHP и расширений
# rpm -qa | grep php
# dnf -y install php
# rpm -qa | grep php
# dnf -y install php-gd php-ldap php-snmp php-bcmath php-mysqlnd
[Date]
; Defines the default timezone uzed by the date functions
; http://php.net/date.timezone
date.timezone = "Europe/Moscow"
Шаг 4. Установка MariaDB
# dnf -y install mariadb-server mariadb
# systemctl status mariadb.service
# systemctl start mariadb.service
# systemctl enable httpd mariadb
# 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, you should just press enter here.
Enter current password for root (enter for none): нажать Enter на клавиатуре
OK, successfully used password, moving on ...
Settings the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password: xgP-aeR-QKp-f#G
Re-enter new password: xgP-aeR-QKp-f#G
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.
Remoov anonymous users? [Y/n] y
... Success!
Disallow root login remotely? [Y/n] y
... Success!
Remove test database and access to it? [Y/n] y
... Success!
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!
- database (имя базы данных) - db_racktables
- user - racktables
- password - nG5-34k-pCL
# mysql -u root -p
Enter password: xgP-aeR-QKp-f#G
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE racktables_db CHARACTER SET = utf8 COLLATE = utf8_general_ci;
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> CREATE USER racktables_nocip@localhost IDENTIFIED BY 'nG5-34k-pCL';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON racktables_db.* TO racktables_nocip@localhost;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> QUIT;
Bye
# systemctl restart mariadb.service
# mysql -u racktables_nocip -p
Шаг 4. Установка RackTables
# rpm -qa | grep wget
# dnf -y install wget
# wget https://sourceforge.net/projects/racktables/files/RackTables-0.22.0.tar.gz
# tar -xvzf RackTables-0.22.0.tar.gz
# mkdir /var/www/html/racktables
# cp -r RackTables-0.22.0/wwwroot /var/www/html/racktables
# touch /var/www/html/racktables/wwwroot/inc/secret.php
# chmod a=rw /var/www/html/racktables/wwwroot/inc/secret.php
# nano /etc/sysconfig/selinux
# reboot
- database: racktables_db
- username: racktables_nocip
- password: nG5-34k-pCL
# chown apache:apache /var/www/html/racktables/wwwroot/inc/secret.php
# chmod 440 /var/www/html/racktables/wwwroot/inc/secret.php
-rw-rw-rw-. 1 root root 2297 Dec 2 22:30 secret.php
-r--r-----. 1 400 apache 2297 Dec 2 22:30 secret.php
# nano /etc/sysconfig/selinux
# reboot
# mysql -u racktables_nocip -p
Enter password: xgP-aeR-QKp-f#G
MariaDB [(none)]> use racktables_db
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [racktables_db]> UPDATE UserAccount SET user_name = 'admin', user_password_hash = SHA1('mynewpassword') where user_id = 1;
MariaDB [racktables_db]> quit;
# reboot