云网牛站
所在位置:首页 > Linux云服务器 > 在Ubuntu 18.04系统上安装和配置phpIPAM的方法

在Ubuntu 18.04系统上安装和配置phpIPAM的方法

2019-01-14 11:08:20作者:戴进稿源:云网牛站

本文介绍在Ubuntu 18.04系统上安装和配置phpIPAM的方法。phpIPAM是一个基于php的开源Web IP地址管理应用程序(IPAM),其目标是提供轻松、现代和有用的IP地址管理。

 

一、安装MariaDB

请阅读在Ubuntu 18.04系统上安装MariaDB 10.4的步骤

完成数据库安装和设置后,为phpipam用户创建一个数据库:

root@server-01:~# mysql -u root -p

Enter password: 

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 49

Server version: 10.4.1-MariaDB-1:10.4.1+maria~bionic-log mariadb.org binary distribution

MariaDB [(none)]> create database phpipam;

Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> grant all on phpipam.* to phpipam@localhost identified by 'strongpassword';

Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> show grants for phpipam@localhost;

Grants for phpipam@localhost

GRANT USAGE ON *.* TO 'phpipam'@'localhost' IDENTIFIED BY PASSWORD '*FAB0955B2CE7AE2DAFEE46C36501AFC6E65A445D'

GRANT ALL PRIVILEGES ON `phpipam`.* TO 'phpipam'@'localhost'

2 rows in set (0.000 sec)

 

二、安装php和所需的模块

运行以下命令安装php和所需的模块:

$ sudo apt-get -y install php7.2-mysql php7.2-curl \

php7.2-gd php7.2-intl php-pear php7.2-imap php-memcache  \

php7.2-pspell php7.2-recode  php7.2-tidy php7.2-xmlrpc \

php7.2-mbstring php-gettext php7.2-gmp php7.2-json  php7.2-xml

安装php-fpm包的命令:

$ sudo apt-get install php-fpm

$ sudo systemctl status php7.2-fpm.service 

php7.2-fpm.service - The PHP 7.2 FastCGI Process Manager

Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled)

Active: active (running) since Sun 2019-01-13 20:57:07 UTC; 36s ago

Docs: man:php-fpm7.2(8)

Main PID: 19135 (php-fpm7.2)

Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"

Tasks: 3 (limit: 2362)

CGroup: /system.slice/php7.2-fpm.service

├─19135 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)

├─19151 php-fpm: pool www

└─19154 php-fpm: pool www

Jan 13 20:57:07 server-01 systemd[1]: Starting The PHP 7.2 FastCGI Process Manager...

Jan 13 20:57:07 server-01 systemd[1]: Started The PHP 7.2 FastCGI Process Manager.

 

三、下载并安装phpIPAM

首先安装git,运行以下命令:

$ sudo apt-get install git

从github Clone phpIPAM code:

# git clone --recursive https://github.com/phpipam/phpipam.git /var/www/phpipam

Cloning into '/var/www/phpipam'...

remote: Counting objects: 17820, done.

remote: Compressing objects: 100% (16/16), done.

remote: Total 17820 (delta 2), reused 5 (delta 0), pack-reused 17804

Receiving objects: 100% (17820/17820), 12.77 MiB | 13.11 MiB/s, done.

Resolving deltas: 100% (12873/12873), done.

Submodule 'app/login/captcha' (https://github.com/dapphp/securimage.git) registered for path 'app/login/captcha'

Submodule 'functions/PHPMailer' (https://github.com/PHPMailer/PHPMailer.git) registered for path 'functions/PHPMailer'

Submodule 'functions/php-saml' (https://github.com/onelogin/php-saml.git) registered for path 'functions/php-saml'

Cloning into '/var/www/phpipam/app/login/captcha'...

remote: Counting objects: 1190, done.        

remote: Total 1190 (delta 0), reused 0 (delta 0), pack-reused 1190        

Receiving objects: 100% (1190/1190), 11.06 MiB | 13.12 MiB/s, done.

Resolving deltas: 100% (590/590), done.

Cloning into '/var/www/phpipam/functions/PHPMailer'...

remote: Counting objects: 6413, done.        

remote: Compressing objects: 100% (14/14), done.        

remote: Total 6413 (delta 4), reused 8 (delta 3), pack-reused 6396        

Receiving objects: 100% (6413/6413), 4.49 MiB | 8.12 MiB/s, done.

Resolving deltas: 100% (4204/4204), done.

Cloning into '/var/www/phpipam/functions/php-saml'...

remote: Counting objects: 4248, done.        

remote: Compressing objects: 100% (21/21), done.        

remote: Total 4248 (delta 9), reused 18 (delta 7), pack-reused 4220        

Receiving objects: 100% (4248/4248), 2.67 MiB | 6.31 MiB/s, done.

Resolving deltas: 100% (2463/2463), done.

Submodule path 'app/login/captcha': checked out '6db3038fd2ef00d4cfb57b866d2cc146c286359b'

Submodule path 'functions/PHPMailer': checked out 'f97b9cd3c2dcf348d110d17613a82614d1163ab5'

Submodule path 'functions/php-saml': checked out '97eb229922be90914797b512d578e791e8bba5b9'

更改为clone目录和稳定版本分支:

#  cd /var/www/phpipam

#  git checkout -b 1.3 origin/1.3

Branch '1.3' set up to track remote branch '1.3' from 'origin'.

Switched to a new branch '1.3'

注:你还可以从 https://sourceforge.net/projects/phpipam/ 下载phpipam并将其解压缩到Web服务器目录。

 

四、配置phpIPAM

将工作目录更改为/var/www/phpipam并将config.dist.php复制到config.php,然后进行编辑:

# cd /var/www/phpipam

# cp config.dist.php config.php

编辑文件以配置在步骤1中添加的数据库凭据:

/**

* database connection details

******************************/

$db['host'] = 'localhost';

$db['user'] = 'phpipam';

$db['pass'] = 'strongpassword';

$db['name'] = 'phpipam';

$db['port'] = 3306;

 

五、安装和配置nginx

使用以下命令安装nginx:

$ sudo apt-get install nginx

配置nginx:

# vim /etc/nginx/conf.d/phpipam.conf

添加以下内容:

server {

# root directory

root   /var/www/;

# phpipam

location /phpipam/ {

try_files $uri $uri/ /phpipam/index.php;

index index.php;

}

# phpipam - api

location /phpipam/api/ {

try_files $uri $uri/ /phpipam/api/index.php;

}

# php-fpm

location ~ \.php$ {

fastcgi_pass   unix:/run/php/php7.2-fpm.sock;

fastcgi_index  index.php;

try_files      $uri $uri/ index.php = 404;

include        fastcgi_params;

}

}

将/var/www/目录的所有权更改为www-data用户和组:

# chown -R www-data:www-data /var/www/

 

六、安装和配置Apache Web服务器

如果想使用Apache Web服务器,请先使用以下命令安装它:

$ sudo apt-get install apache2

$ sudo a2enmod rewrite

Enabling module rewrite.

To activate the new configuration, you need to run:

systemctl restart apache2

安装apache php模块:

$ sudo apt-get install libapache2-mod-php php-curl php-xmlrpc php-intl php-gd

添加apache phpipam配置(请注意更改为自己的地址):

运行:cat /etc/apache2/conf-enabled/phpipam.conf 

<VirtualHost *:80>

ServerAdmin admin@phpipam.yourdomain.com

DocumentRoot "/var/www/phpipam"

ServerName phpipam.computingforgeeks.com

ServerAlias www.phpipam.computingforgeeks.com

<Directory "/var/www/phpipam">

Options Indexes FollowSymLinks

AllowOverride All

Require all granted

</Directory>

ErrorLog "/var/log/phpipam.yourdomain.com-error_log"

CustomLog "/var/log/phpipam.yourdomain.com-access_log" combined

</VirtualHost>

重新启动apache服务器以进行更改。

$ sudo systemctl restart apache2

 

七、图形化安装配置phpipam

做完以上的步骤,就来采用图形化安装配置phpipam,访问地址,请使用你的有效域名来访问,并开始安装过程。

选择新的phpipam安装(New phpipam installation):

在Ubuntu 18.04系统上安装和配置phpIPAM的方法

然后选择数据库安装方法,如果已为phpipam创建了数据库,则可以选择MySQL导入指令,否则请选择自动数据库安装:

在Ubuntu 18.04系统上安装和配置phpIPAM的方法

对于自动安装需要提供root密码:

在Ubuntu 18.04系统上安装和配置phpIPAM的方法

在Ubuntu 18.04系统上安装和配置phpIPAM的方法

在Ubuntu 18.04系统上安装和配置phpIPAM的方法

成功安装后,就能出现管理员登录页面,然后使用上面设置的登录即可:

在Ubuntu 18.04系统上安装和配置phpIPAM的方法

在Ubuntu 18.04系统上安装和配置phpIPAM的方法

如上图,已经进入到了phpipam管理面板中。至此,图形化安装phpipam结束。

 

相关主题

Ubuntu 18.04系统中使用Apache搭建简单的web服务器

精选文章
热门文章