$ sudo apt-get update
$ sudo apt install default-jre
Check Java installation
$ java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.18.04)
OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)
$ wget https://download.igniterealtime.org/openfire/openfire_4_6_7.tar.gz
$ tar -xvzf openfire_4_6_7.tar.gz
Move Openfire to /opt/
$ sudo mv openfire/ /opt/
Prepare Openfire with systemd
$ sudo vi /etc/systemd/system/openfire.service
Add this service definition (openfire.service
)
[Unit]
Description=Openfire service
After=network.target
[Service]
Type=forking
User=vagrant
ExecStart=/bin/sh -c "/opt/openfire/bin/openfire start"
StandardOutput=file:/var/log/openfire.log
StandardError=file:/var/log/openfire-error.log
Restart=on-failure
[Install]
WantedBy=multi-user.target
Reload systemd
and enable Openfire
$ sudo systemctl daemon-reload
$ sudo systemctl enable openfire.service
Start Openfire
$ sudo systemctl start openfire.service
$ sudo apt-get install postgresql postgresql-contrib
When the installation is complete, the PostgreSQL server is running, and a Linux user account called postgres has been created.
$ sudo --login --user postgres
$ psql
$ postgres=# CREATE DATABASE openfire;
$ postgres=# CREATE USER openfire WITH PASSWORD 'fire12345';
$ postgres=# GRANT ALL PRIVILEGES ON DATABASE openfire to openfire;
$ postgres=# \q
$ exit
If you use a different server for your database and the openfire server, you may allow PostgreSQL to listen on all assigned IP Addresses. To do so, open /etc/postgresql/10/main/postgresql.conf as root in a text editor. As a best practice, ensure that only the openfire server is able to connect to the PostgreSQL port using a firewall.
$ sudo vi /etc/postgresql/10/main/postgresql.conf
#listen_addresses = 'localhost'
listen_addresses = '*'
$ sudo systemctl restart postgresql
-
If the openfire server and the database are on the same machine:
- Open /etc/postgresql/10/main/pg_hba.conf as root in a text editor.
- Find the following line
local all all peer
- Change
peer
totrust
local all all trust
-
If the openfire server and the database are on different machines:
- Open /etc/postgresql/10/main/pg_hba.conf as root in a text editor.
- Add the following line to the end of the file, where {openfire-server-IP} is the IP address of the machine that contains the openfire server
host all all {openfire-server-IP}/32 md5
$ sudo systemctl reload postgresql
- If the openfire server and the database are on the same machine, use the following command:
$ psql --dbname=openfire --username=openfire --password
- If the openfire server is on a different machine, log into that machine and use the following command:
$ psql --host={postgres-server-IP} --dbname=openfire --username=openfire --password
Visit Openfire Admin Console: http://localhost:9090