Установка RackTables на виртуальную машину
Отредактирована 27.11.2024
- Создать виртуальную машину и установить на неё CentOS 7, плюс установим сетевые утилиты;
- Выполнить сетевые настройки, чтобы сам host был доступен по ip адресу. Если конечно вы это не сделали при установке OS.
# nano /etc/hostname
# systemctl reboot
$ hostname ; hostname -I ; sestatus ; cat /etc/redhat-release
RackTables
192.168.56.5
SELinux status: disabled
CentOS Linux release 7.9.2009 (Core)
# firewall-cmd --permanent --zone=public --add-service=http
success
# firewall-cmd --permanent --zone=public --add-port=80/tcp
success
# firewall-cmd --reload
# firewall-cmd --list-all
# yum -y install epel-release
# yum -y install php php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel httpd php-pdo php-bcmath php-mysql
# service httpd restart
# rm -f /etc/httpd/conf.d/welcome.conf
ServerName 192.168.56.5:80
[Date]
; Defines the default timezone uzed by the date functions
; http://php.net/date.timezone
date.timezone = "Europe/Moscow"
# netstat -tulpn
# yum -y install mariadb-server mariadb
# systemctl restart 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, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): нажать Enter на клавиатуре
Set root password? [Y/n] y
New password: xgP-aeR-Qlp-#fG
Re-enter new password: xgP-aeR-Qlp-#fG
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
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
Thanks for using MariaDB!
- user - racktables
- password - xgP-aeR-Qlp-#fG
- database (имя базы данных) - racktables_db
# mysql -u root -p
Enter password: xgP-aeR-Qlp-#fG
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@localhost identified by 'xgP-aeR-Qlp-#fG';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on racktables_db.* to racktables@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 start mariadb.service httpd.service
# systemctl enable mariadb.service httpd.service
# mysql -u racktables -p
# yum -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 666 /var/www/html/racktables/wwwroot/inc/secret.php
Упс, дальше нас не пускает, нужно обновить PHP version >= 7.0
# php -v
PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
# yum -y install yum-utils
Нам нужно установить версию PHP больше или равно 7. На официальном ресурсе можно посмотреть какие версии актуальные на текущий момент времени, ниже показано как установить версии от 7 и выше
# yum-config-manager --enable remi-php71
# yum-config-manager --enable remi-php72
# yum-config-manager --enable remi-php73
# yum-config-manager --enable remi-php74
# yum-config-manager --enable remi-php81
# yum -y update
# php -v
PHP 8.1.8 (cli) (built: Jul 5 2022 21:55:55) ( NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.8, Copyright (c) Zend Technologies
# reboot
- database: racktables_db
- username: racktables
- password: xgP-aeR-Qlp-#fG
# chown apache:apache /var/www/html/racktables/wwwroot/inc/secret.php
# chmod 400 /var/www/html/racktables/wwwroot/inc/secret.php
-rw-rw-rw- 1 root root 2303 июл 29 16:23 secret.php
-r-------- 1 apache apache 2303 июл 29 16:23 secret.php
# mysql -u racktables -p
Enter password: xgP-aeR-Qlp-#fG
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
Нажмите «RackTables Administrator» (вверху справа) -> вкладка «Quick links».
Проверьте конфигурацию и сохраните ее, нажав синюю стрелку внизу страницы. Мы проверили и сохранили «пользовательский интерфейс» на изображении ниже, которое будет отображаться на панели инструментов.
# setenforce 1