如何在Ubuntu 18.04/Ubuntu 16.04 Linux上安装RackTables

时间:2020-02-23 14:38:47  来源:igfitidea点击:

其中我们将学习在Ubuntu 18.04/Ubuntu 16.04 LTS Linux系统上安装RackTables。
RackTables是一种强大而漂亮的工具,旨在管理数据中心和服务器室资产。
RackTables允许我们管理凭证硬件资产,网络地址,机架中的空间,网络配置等等。
在我们覆盖的系列中早些时候:

RackTables要求

机架需要:用于后端数据的Front-EndMysql/Mariadb数据库服务器的Web-Server - Apache或者Nginxphp 5.5.0或者更新。

在Ubuntu服务器上设置仓库,我们将安装这些所需的软件包。
对于数据库,我们将使用MariaDB,对于Web Server我们将使用Nginx。

第1步:安装PHP

Ubuntu 18.04在其存储库中具有PHP 7.2,而PHP 7.0 Ubuntu 16.04 LT。
使用命令安装Ubuntu和所需的扩展名:

sudo apt-get install php php-cli php-snmp php-gd php-mysql php-mbstring php-bcmath php-json

第2步:安装MariaDB数据库服务器

要在Ubuntu 18.04和Ubuntu 16.04服务器上安装MariaDB,请按照以下教程进行操作:

在Ubuntu 18.04和Centos 7上安装MariaDB 10.x

如何在Ubuntu 16.04(Xenial Xerus)LTS上安装MariaDB 10.3

安装MariaDB数据库服务器后,为机架创建数据库和用户

CREATE DATABASE racktables CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES on racktables.* TO 'racktables'@'localhost' IDENTIFIED BY "StrongPassword";
FLUSH PRIVILEGES;
QUIT;

第3步:安装nginx和php-fpm

PHP-FPM(FastCGI Process Manager)是一种备用PHP FastCGI实现,具有一些添加功能。
在本节中,我们将安装nginx Web服务器和PHP-FPM。

sudo apt install -y nginx php-fpm

为机架创建nginx配置文件

server {
        listen 80;
        server_name racktables.example.com;
        root /srv/racktables/wwwroot;
        location/{
            index index.php;
        }
        location ~ \.php${
            try_files $uri =404;
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
        }
    }

你需要替换 /srv/racktables使用RackTables根文件夹。
对于Ubuntu 16.04,FastCgi_pass将指向 /run/php/php7.0-fpm.sock检查确认配置文件是否正常

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

如果一切似乎可以,重新启动nginx

sudo systemctl restart nginx
sudo systemctl enable nginx

第4步:下载并安装RackTables

我们将下载机架 /srv目录

cd /srv

克隆仓库来自GitHub的源代码

$git clone https://github.com/RackTables/racktables.git
Cloning into 'racktables'...
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 32365 (delta 17), reused 24 (delta 13), pack-reused 32327
Receiving objects: 100% (32365/32365), 25.60 MiB | 625.00 KiB/s, done.
Resolving deltas: 100% (20639/20639), done.

设置目录所有权

sudo chown -R www-data:www-data /srv/racktables

通过打开链接开始安装 http://racktables.example.com/?module=installer并按照说明进行操作。

在第一步,检查继续。
它将进行系统检查,如果全部是绿色,请继续执行步骤3

创建 secret.php并在提示时设置权限。

sudo touch '/srv/racktables/wwwroot/inc/secret.php'
sudo chmod a=rw '/srv/racktables/wwwroot/inc/secret.php'

接下来,配置数据库

UNIX socket: /var/run/mysqld/mysqld.sock
database: racktables
username: racktables
username: StrongPassword

重置允许 /srv/racktables/wwwroot/inc/secret.php

sudo chown www-data:nogroup /srv/racktables/wwwroot/inc/secret.php
chmod 440 /srv/racktables/wwwroot/inc/secret.php

启用存储功能的执行。

SET GLOBAL log_bin_trust_function_creators=1;

在步骤6,创建管理员用户密码。

按下继续后,我们将进入系统。
使用管理员用户名进行身份验证。