openDCIM-4.5安裝步驟Centos7
opendcim版本:4.5
安裝 Apache, PHP, MySQL
1、安裝並啟動Apache:
yum -y install httpd systemctl enable httpd.service systemctl start httpd.service
2、安裝PHP和MBSTRING模塊:
yum -y install php yum -y install php-mysql yum -y install php-mbstring yum -y install php-snmp
3、安裝和啟用MySQL:
yum -y install mariadb-server systemctl enable mariadb.service systemctl start mariadb.service
4、MySQL服務安全設置:
mysql_secure_installation
在這一步中,你將會: #設置完root密碼後,全部按回車
Set a root password(設置mysql的root用戶密碼)
Remove anonymous users(刪除匿名用戶)
Disallow root login remotely(不允許遠程root登錄)
Remove test database and access to it(刪除測試數據庫並訪問它)
Reload privilege tables(重新加載權限表)
5、為openDCIM創建一個數據庫(將數據庫名稱dcim和密碼dcimpassword):
mysql -u root -p MariaDB [(none)]> create database dcim; MariaDB [(none)]> grant all privileges on dcim.* to 'dcim' identified by 'dcimpassword'; MariaDB [(none)]> exit
啟用 HTTPS
1、安裝Apache SSL模塊:
yum -y install mod_ssl
2、生成必要的密鑰並將它們復制到適當的目錄:
cd /root openssl genrsa -out ca.key 1024 openssl req -new -key ca.key -out ca.csr openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt cp ca.crt /etc/pki/tls/certs cp ca.key /etc/pki/tls/private/ca.key cp ca.csr /etc/pki/tls/private/ca.csr
3、設置服務器名稱:
vim +/ServerName /etc/httpd/conf/httpd.conf
找到這行...
#ServerName www.example.com:80
...改成以下:
ServerName opendcim.example.net:443
最後重新啟動Apache……
systemctl restart httpd.service
創建一個虛擬主機
1、創建opendcim文件夾
mkdir -p /var/www/html/openDCIM/opendcim
2、現在,為openDCIM虛擬主機創建一個新的配置文件...
vim /etc/httpd/conf.d/opendcim.example.net.conf
... 增加這些內容...
<VirtualHost *:443> SSLEngine On SSLCertificateFile /etc/pki/tls/certs/ca.crt SSLCertificateKeyFile /etc/pki/tls/private/ca.key ServerAdmin [email protected] DocumentRoot /var/www/html/openDCIM/opendcim ServerName opendcim.example.net <Directory /var/www/html/openDCIM/opendcim> AllowOverride All AuthType Basic AuthName "openDCIM" AuthUserFile /var/www/html/openDCIM/opendcim.htpasswd Require valid-user </Directory> </VirtualHost>
開啟用戶身份驗證
使用基本身份驗證保護openDCIM web目錄,並在上面的Apache配置文件中添加了這些行。
1、現在,要創建至少一個用戶,請執行以下操作:
touch /var/www/html/openDCIM/opendcim.htpasswd htpasswd /var/www/html/openDCIM/opendcim.htpasswd administrator
#為用戶“administrator”兩次輸入密碼。
在防火墻上打開Web訪問
1、Firewall允許HTTPS端口443的訪問
firewall-cmd --zone=public --add-port=443/tcp --permanent
2、重啟 Firewall:
firewall-cmd --reload
下載並安裝openDCIM
1、下載最新版本的openDCIM http://www.opendcim.org/downloads.html (當前最新版本4.5):
cd /var/www/html/openDCIM/
curl -O http://www.opendcim.org/packages/openDCIM-4.5.tar.gz
2、提取文件並創建一個軟(符號)鏈接:
tar zxvf openDCIM-4.5.tar.gz
cd openDCIM-4.5
cp -r * ../opendcim
cd ../opendcim
3、準備配置文件來訪問數據庫:
cd /var/www/html/openDCIM/opendcim
cp db.inc.php-dist db.inc.php
vim db.inc.php
...編輯以下行... #根據相關參數填入據庫用戶名和密碼(在本例中是localhost)、數據庫名稱(dcim),以及在創建數據庫時指定的憑據:
$dbhost = 'localhost'; $dbname = 'dcim'; $dbuser = 'dcim'; $dbpass = 'dcimpassword';
5、最後,最後一次重新啟動Apache:
systemctl restart httpd.service
登陸opendcim
1、瀏覽器打開網址
https://10.100.10.7
2、填入用戶名和密碼
dcim dcimpassword
3、登陸成功後,瀏覽器會顯示以下提示
All is well. Please remove install.php to return to normal functionality (刪除install.php)
4、刪除install.php
mv install.php install.php_bak
openDCIM-4.5安裝步驟Centos7