Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Bandwidthd-pgsql installation Guide

2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Bandwidthd-pgsql is a free traffic statistics tool under Linux, which can be used in the local area network to directly display the traffic usage of each IP.

0. Install linux. This tutorial uses Ubuntu-budgie as a distribution and will be updated after installation.

Sudo apt-get update

Sudo apt-get upgrade

1. Install Apache2

Sudo apt-get install apache2 # basically does not need to change after installation

Test: the browser accesses http://Ubuntu 's IP and It Works appears! Web page.

View status: service apache2 status/start/stop/restart

Web directory: / var/www/html

Installation directory: / etc/apache2/

Global configuration: / etc/apache2/apache2.conf

Listening port: / etc/apache2/ports.conf

Virtual host: / etc/apache2/sites-enabled/000-default.conf

two。 Install PHP

Sudo apt-get install php7.0 libapache2-mod-php7.0 # install php and apache modules

Sudo / etc/init.d/apache2 restart # restart the apache service

Write a test php file info.php # and put it in the / var/www/html directory

Hello php

Enter http://127.0.0.1/info.php in the browser and you can see the information of php

3. Install postgresql database, currently version 9.5

Sudo apt-get install postgresql

Sudo apt-get install php7.0-pgsql php7.0-gd # installs the pgslq module for php

4. Install the visual manager for the phppgadmin # database

After the installation of sudo apt-get install phppgadmin #, you can directly open http://127.0.0.1/phppgadmin, with a browser, but the database cannot log in for the time being.

5. Modify the login file / etc/phppgadmin/config.inc.php of phppgadmin

$conf ['extra_login_security'] = true; change true to false

6. Modify the / etc/postgresql/9.5/main/pg_hba.conf file of the database

Add host all all 0.0.0.0 0.0.0.0 md5 # on the last line to allow all IP access via md5 password authentication

7. Modify the / etc/postgresql/9.5/main/postgresql.conf file of the database to change the address to *

Listen_addresses ='*'

8. Restart the database to make the newly modified configuration file take effect

/ etc/init.d/postgresql restart

9. Configure the password for Postgresql's administrator account postgres so that remote users can access it. By default, PS:PostgreSQL data creates a postgres database user as the database administrator, and the password is random.

Step 1: PostgreSQL login (login using psql client)

# sudo-u postgres psql / / where sudo-u postgres means to log in to the database using postgres users.

Step 2: change the PostgreSQL login password:

Postgres=# ALTER USER postgres WITH PASSWORD 'postgres'; / / postgres=# is the command prompt under PostgreSQL

ALTER USER postgres PASSWORD 'postgres'; / / or use this syntax

Step 3: exit the PostgreSQL psql client

Postgres=#\ Q

10. How to access the database:

Sudo-u postgres psql-p 5432 / /-u is followed by a user name, and-p is followed by a port after 5432 is the default port

Sometimes, it is found that there are two postgres server instances on the same ubuntu, which can be queried with sudo service postgresql status

11. Then in http://127.0.0.1/phppgadmin, select server and log in to the database with postgres/postgres

twelve。 Create Bandwidthd database and account first

Sudo-u postgres psql-p 5432

CREATE USER bandwidthdpgsql

ALTER USER bandwidthdpgsql PASSWORD '123456'

Create database bandwidthdpgsql

13. Install Bandwidthd-pgsql softwar

Sudo apt-get install bandwidthd-pgsql / / will prompt the monitoring network card, network segment, database address (select localhost), the password can directly enter or enter the 123456 just set, it is recommended to enter directly.

14. Modify / etc/bandwidthd/bandwidthd.conf configuration file

You can set subnet if you enter it incorrectly during installation

Subnet 10.0.0.0 255.0.0.0

Subnet 192.168.0.0 255.255.0.0

Subnet 172.16.0.0 255.255.0.0

The connection information of the database can be modified because it has been set up at the time of installation and generally does not need to be changed.

Pgsql_connect_string "user = bandwidthdpgsql password = 123456 dbname = bandwidthdpgsql host = localhost"

The working mode of network card is changed to "hybrid mode".

Promiscuous true

# promiscuous false

15. / etc/init.d/bandwidthd restart # restart the bandwidthd service

2-3 minutes after startup, look at the database with the pgadmin tool and you can see the data.

16. Make a soft connection to the bandwidthd page address under / var/www/html

Sudo ln-s / var/lib/bandwidthd/htdocs/ / var/www/html/bandwidthd

17. Type 127.0.0.1/bandwidthd/sensors.php in the browser and you can see the information.

Or rename the sensors.php in the / var/lib/bandwidthd/htdocs/ directory to index.php and access it directly through 127.0.0.1/bandwidthd/.

The results of traffic statistics are as follows:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report