Como instalar PHPIPAM no Debian 9
Posted in: Linux

Como instalar PHPIPAM no Debian 9

Neste artigo vou demonstrar como instalar PHPIPam para gerir os nossos IPs internamente.

Antes de iniciar vamos actualizar os nossos repos e instalar as dependencias necessárias.

sudo apt update
sudo apt upgrade -y

Dependências PHPIPAM

sudo apt-get install  fping php7.0-snmp apache2 mariadb-server php php-pear php7.0-gmp php7.0-mysql php7.0-mbstring php7.0-gd php7.0-mcrypt php7.0-curl git -y 
sudo apt -y install php php-{mysql,curl,gd,intl,pear,imap,memcache,pspell,tidy,xmlrpc,mbstring,gmp,json,xml,fpm,snmp}

Configurar Apache

mkdir /var/www/phpipam/
sudo vi /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
	DocumentRoot /var/www/phpipam
	<Directory "/var/www/phpipam">
		Options FollowSymLinks
		AllowOverride all
		Order allow,deny
		Allow from all
	</Directory>
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2enmod rewrite
sudo service apache2 restart
sudo service apache2 enable
apache2ctl -t
sudo chown www-data:www-data -R /var/www/phpipam/
cd /var/www/phpipam/
sudo find . -type f -exec chmod 0644 {} \;
sudo find . -type d -exec chmod 0755 {} \;

Configurar MySQL

sudo mysql_secure_installation
mysql -u root -p

Criar Base Dados para PHPIPAM

CREATE DATABASE PHPIPAM01;
CREATE USER 'RFS'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'RFS'@'localhost' with grant option;
FLUSH PRIVILEGES;

Download PhpIPAM

sudo git clone --recursive https://github.com/phpipam/phpipam.git /var/www/phpipam
cd /var/www/phpipam
git checkout -b 1.5 origin/1.5

Configurar ficheiro config.php

sudo cp -v  config.dist.php config.php 
sudo nano config.php 

CronJob

echo "# update host statuses every 5 minutes
*/5 * * * * www-data /usr/bin/php /var/www/phpipam/functions/scripts/pingCheck.php >> /dev/null 2>&1
*/5 * * * * www-data /usr/bin/php /var/www/phpipam/functions/scripts/discoveryCheck.php >> /dev/null 2>&1" | sudo tee /etc/cron.d/phpipam

Instalar PHPIPAM

instalar PHPIPAM
instalar PHPIPAM
image 1

image 2

Instalar PowerDNS

sudo apt install pdns-server pdns-backend-mysql
sudo systemctl restart pdns
sudo systemctl enable pdns

Instalar PowerDNS Admin

sudo apt install python3-dev
sudo apt install libsasl2-dev libldap2-dev libssl-dev libxml2-dev libxslt1-dev libxmlsec1-dev libffi-dev pkg-config apt-transport-https virtualenv python3-venv build-essential libmariadb-dev git python3-flask -y
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn -y

Site Oficial PHPIpam

Back to Top