Introduction
PhpIPAM is one of the best open-source Internet Protocol (IP) address management software used by some of the best web hosting services
Before You Begin
For the phpIPAM application to run flawlessly on your CentOS server, you must install the following applications:
- PHP and the required PHP modules
- Apache web server
- MariaDB database
Step 1 – Installing The Dependencies And Preparing The Environment
Setting The Locale
Before you install phpIPAM on CentOS 7, you must set the precise locale to be utilized on your server. First, issue the command below to open the file /etc/environment:
$ sudo nano /etc/environment
Once the file opens, add the content below for en_US coding. If you intend to use a different location, then add your own encoding:
LC_ALL=en_US.utf-8 LANG=en_US.utf-8
Installing The LAMP Stack Modules
Once you set the locale, you can now install the dependencies. First, issue the command below to install all the necessary modules for phpIPAM:
$ sudo yum install httpd mariadb-server php php-cli php-gd php-common php-ldap php-pdo php-pear php-snmp php-xml php-mysql php-mbstring git
Configuring Apache Web Server
The next thing is to edit the main configuration file for Apache to configure the web server. Here, first, execute the command below to open the Apache’s main configuration file:
$ sudo nano /etc/httpd/conf/httpd.conf
Once you are on this file, change the settings for the directory, /var/www/html to permit URL rewrites for mod_rewrite.
<Directory "/var/www/html"> Options FollowSymLinks AllowOverrideall Order allow,deny Allow from all </Directory>
Next, you can modify the server name to localhost, but remember to change this name to your correct domain name.
ServerName locahost:80
Save the changes and exit the nano editor. Now, execute the command below open the /etc/php.ini file and set the accurate timezone to prevent php warnings:
$ sudo nano /etc/php.ini
Make the following changes
; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Europe/Ljubljana
Save and exit the nano editor, then run the commands below to start the Apache web server and enable it to start at boot,
$ sudo service httpd start $ sudo chkconfig httpd on
Alternatively, if you are using systemd, issue the commands below
$ sudo systemctl start httpd $ sudo systemctl enable httpd
Next, adjust the firewall settings to permit HTTP and HTTPs traffic to pass to Apache:
$ sudo firewall-cmd --permanent --add-port=80/tcp $ sudo firewall-cmd --permanent --add-port=443/tcp $ sudo firewall-cmd --reload
Setting Up The Database
To set up the database for phpIPAM on your CentOS system, first, run the command below to start MariaDB and enable the service to run at boot.
$ sudo service mariadb start $ sudo chkconfig mariadb on
If you are using systemd, run the commands below:
$ sudo systemctl start mariadb $ sudo systemctl enable mariadb
You can now, run the command below to enhance the security for this database:
$ sudo mysql_secure_installation
Answer the questions in the prompt and set a strong root password:
Step 2 – Downloading And Configuring PhpIPAM
By now the database server and the web server are correctly configured, its time to configure the phpIPAM.
Downloading The Installation Files
In this tutorial, we’ll use the Git system to download the files from the GitHub repository. If you have not installed Git on your server, run the command below to deploy it:
$ sudo yum install git
Next, execute the command below to change the directory to /var/www/html/
$ sudo cd /var/www/html/
Then issue the following command to download phpIPAM:
$ sudo git clone https://github.com/phpipam/phpipam.git
You will see the following once the download is complete:
Cloninginto'.'... remote: Counting objects: 10513,done. remote: Compressing objects: 100%(2/2),done. remote: Total10513(delta0),reused0(delta0),pack-reused10511 Receiving objects: 100%(10513/10513),7.84MiB| 2.59 MiB/s, done. Resolving deltas: 100% (7310/7310), done.
Now, issue the command below to confirm the stable release branch:
$ Sudo git checkout 1.3
Note: if you want to use the development version of phpIPAM, do not run the command git checkout 1.3. This will utilize the available master version. However, if you have confirmed version 1.3, run the command below to change to the master version.
$ sudo git checkout master
PhpIPAM will be downloaded in the directory /var/www/html which is the root directory. You can now change the ownership and confirm the accessibility of the upload folders for all xls/csv imports:
$ sudo chown apache:apache -R /var/www/html/ $ sudo chcon -t httpd_sys_content_t /var/www/html/ -R $ cd /var/www/html/ find . -type f -exec chmod 0644 {} ; find . -type d -exec chmod 0755 {} ; $ sudo chcon -t httpd_sys_rw_content_t app/admin/import-export/upload/ -R $ sudo chcon -t httpd_sys_rw_content_t app/subnets/import-subnet/upload/ -R $ sudo chcon -t httpd_sys_rw_content_t css/1.3.1/images/logo/ -R
Configuring The Database Connection
To set up the connection to the database, copy the file config.dist.php over the config.php file:
$ sudo cp config.dist.php config.php
Next, open the config.php file then make changes to the database connection settings.
Step 3 – Installing PhpIPAM
The stage is set and it should be easy to complete this installation. Open your favorite browser and search http://ip_address/ to access the installation wizard. Once you are on the Wizard, choose New phpipam installation: Then select Automatic database installation. This will take you to a new window, enter the root credentials; created when configuring your database, and click Install phpipam database. Click Continue on the confirmation message to proceed with the post configuration process. Here, set your admin password, site URL and the site title, then click Save settings. That is it! You will get a confirmation message. Click proceed to login to get to the login page and use your admin credentials to log in to phpIPAM.
Conclusion
You have successfully installed phpIPAM on your CentOS VPS or Dedicated server. You can now enjoy the power and convenience of this application to manage your IP addresses.
Check out these top 3 VPS services: