Skip to content
Wilbur Longwisch edited this page Sep 30, 2023 · 7 revisions

Ubuntu 20.04 Installation Instructions

Install all the components that are necessary

sudo apt update

sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y

sudo add-apt-repository ppa:ondrej/php

 Co-installable PHP versions: PHP 5.6, PHP 7.x, PHP 8.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.

Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa

You can get more information about the packages at https://deb.sury.org

IMPORTANT: The <foo>-backports is now required on older Ubuntu releases.

BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting

CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline
   or ppa:ondrej/nginx

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/

WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or Ctrl-c to cancel adding it.
sudo apt install -y php8.2 php8.2-mbstring php8.2-snmp php8.2-gd php8.2-mysql php8.2-zip php8.2-curl php8.2-ldap php8.2-xml php8.2-intl php8.2-common mariadb-server tzdata locales-all graphviz locales apache2

Enable mariadb and apache to start at boot

sudo systemctl enable apache2.service --now
sudo systemctl enable mariadb.service --now

Configure mariadb

sudo mysql_secure_installation

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!
Remove anonymous users? [Y/n] 
 ... Success!
Disallow root login remotely? [Y/n] 
 ... Success!
Remove test database and access to it? [Y/n]
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reload privilege tables now? [Y/n]
 ... Success!

Create database

# sudo mysql -u root -p
MariaDB [(none)]> create database dcim;
MariaDB [(none)]> grant all privileges on dcim.* to 'dcim' identified by 'dcim';
MariaDB [(none)]> exit

Create SSL certificate

sudo openssl req -x509 -newkey rsa:4096 -keyout /etc/ssl/private/localhost.key -out /etc/ssl/certs/localhost.crt -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=$(hostname)"

Add a virtual host for opendcim

# sudo vim /etc/apache2/sites-available/opendcim.conf
 <VirtualHost *:443>
     ServerAdmin you@example.net
     DocumentRoot /opt/openDCIM/opendcim
     ServerName opendcim.example.net
     SSLEngine on
     SSLCertificateKeyFile "/etc/ssl/private/localhost.key"
     SSLCertificateFile "/etc/ssl/certs/localhost.crt"
     AllowEncodedSlashes On
     <Directory "/opt/openDCIM">
         AllowOverride None
         Options Indexes FollowSymLinks
         # Allow open access:
         Require all granted
     </Directory>
     <Directory /opt/openDCIM/opendcim>
         AllowOverride All
         AuthType Basic
         AuthName "openDCIM"
         AuthUserFile /opt/openDCIM/.htpasswd
         Require valid-user
     </Directory>
 </VirtualHost>

Create opendcim directories and get application from github

sudo mkdir -p /opt/openDCIM/
cd /opt/openDCIM/
sudo wget https://github.com/opendcim/openDCIM/archive/refs/tags/23.03.tar.gz
sudo tar -zxpf 23.03.tar.gz
sudo ln -s openDCIM-23.03 opendcim
sudo mkdir -p assets/{pictures,drawings}
sudo chown www-data:www-data assets/*
sudo ln -s /opt/openDCIM/assets/ /opt/openDCIM/opendcim/
sudo cp opendcim/db.inc.php-dist opendcim/db.inc.php

Add user to htpasswd for apache authentication

sudo htpasswd -c /opt/openDCIM/.htpasswd dcim

Enable rewrite and ssl modules as well as new opendcim site then restart apache2

sudo a2enmod rewrite
sudo a2enmod ssl
sudo a2ensite opendcim.conf
sudo systemctl restart apache2

Log in as user dcim and whatever password you set and finish the install

https://<server ip goes here>
Clone this wiki locally