How to Install HumHub on Ubuntu Server Latest

HumHub is an open-source social network software that helps you to create your own social network platform, intranet, or community. This tutorial will guide you on how to install HumHub on Ubuntu Server.

Prerequisites

Before you start the installation process, make sure you have the following requirements:

Step 1: Update System Packages

First, you need to update your system packages to ensure your server is running with the latest updates.

Log in to your server with your sudo user credentials and execute the following command:

sudo apt update
sudo apt upgrade

This will update your system packages to the latest version.

Step 2: Install LAMP Stack

HumHub is built with PHP and MySQL database; therefore, you need to install the LAMP stack on your server.

You can install the LAMP stack by executing the following command:

sudo apt install apache2 php mysql-server php-mysql libapache2-mod-php php-xml php-mbstring php-gd php-zip

Afterward, restart your Apache web server to apply the changes:

sudo systemctl restart apache2

Step 3: Install Other Required Dependencies

HumHub needs a few additional dependencies that need to be installed. For that, execute the following command:

sudo apt install curl zip unzip git

Step 4: Install HumHub

After installing the LAMP stack and other dependencies, you can install HumHub on your server. For that, follow the below steps:

  1. Create a document root directory for HumHub:

    sudo mkdir /var/www/humhub
    
  2. Change the ownership of the directory:

    sudo chown -R www-data:www-data /var/www/humhub
    
  3. Navigate to the directory:

    cd /var/www/humhub
    
  4. Download the HumHub installation package:

    wget https://www.humhub.org/en/download/start?version=latest
    
  5. Extract the downloaded package:

    unzip start\?version\=latest
    
  6. Rename the extracted directory:

    mv humhub-<version> humhub
    

    Replace with the actual HumHub version.

  7. Set necessary ownership permissions:

    sudo chown -R www-data:www-data /var/www/humhub
    
  8. Create a database and user for HumHub:

    sudo mysql -u root -p
    

    Enter your MySQL root password and execute the below command to create a new database and user:

    CREATE DATABASE humhub CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    GRANT ALL PRIVILEGES ON humhub.* TO 'humhub_user'@'localhost' IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;
    EXIT;
    

    Replace the values humhub_user and password with your preferred username and password.

  9. Navigate to the HumHub directory:

    cd /var/www/humhub
    
  10. Install HumHub using the following command:

    sudo php protected/install/install.php
    

    You will be prompted to enter necessary installation details like database name, database user, and password.

    Enter the details as shown below:

    Database name: humhub
    Database user: humhub_user
    Database password: <Password that you set for the user>
    

    After that, enter the email address and other necessary details to complete the installation process.

    Once the installation process is completed, set the necessary file permissions for HumHub by running the following command:

    sudo chmod -R 777 protected/runtime protected/config protected/migrations/ protected/modules/
    

Step 5: Configure Web Server

Now, you need to configure your web server to serve HumHub content.

Apache Configuration

Create a new virtual host file for HumHub:

sudo nano /etc/apache2/sites-available/humhub.conf

Add the following lines to the file:

<VirtualHost *:80>
   ServerName example.com
   Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost *:443>
   ServerName example.com
   DocumentRoot /var/www/humhub
   <Directory /var/www/humhub>
       Options FollowSymLinks
       AllowOverride All
       Order allow,deny
       allow from all
   </Directory>
   ErrorLog ${APACHE_LOG_DIR}/humhub_error.log
   CustomLog ${APACHE_LOG_DIR}/humhub_access.log combined
   SSLEngine on
   SSLCertificateFile /path/to/ssl/certificate
   SSLCertificateKeyFile /path/to/ssl/private/key
   SSLCertificateChainFile /path/to/ssl/intermediate/ca
</VirtualHost>

Replace example.com with your own domain name, /path/to/ssl/certificate with your SSL certificate file path, and /path/to/ssl/private/key with your SSL certificate private key path.

Enable the virtual host file and restart Apache to apply the changes:

sudo a2ensite humhub.conf
sudo systemctl restart apache2

Nginx Configuration

Create a new virtual host configuration file for HumHub:

sudo nano /etc/nginx/sites-available/humhub.conf

Add the following lines to the file:

server {
   listen 80;
   server_name example.com;
   return 301 https://$server_name$request_uri;
}

server {
   listen 443 ssl;
   server_name example.com;
   root /var/www/humhub;
   index index.php;

   ssl_certificate /path/to/ssl/certificate;
   ssl_certificate_key /path/to/ssl/private/key;
   ssl_trusted_certificate /path/to/ssl/intermediate/ca;

   location / {
       try_files $uri $uri/ /index.php?$args;
   }

   location ~\.php$ {
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
       fastcgi_index index.php;
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_param PATH_INFO $fastcgi_path_info;
   }

   location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
       expires max;
       log_not_found off;
   }
}

Replace example.com with your own domain name, /path/to/ssl/certificate with your SSL certificate file path, and /path/to/ssl/private/key with your SSL certificate private key path.

Save and close the file.

Link the virtual host file to the sites-enabled directory and restart Nginx to apply the changes:

sudo ln -s /etc/nginx/sites-available/humhub.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Step 6: Access HumHub

Once the installation and configuration process is completed successfully, you can access your HumHub social network software by visiting https://example.com in your web browser.

Conclusion

Now you know how to install HumHub on Ubuntu Server Latest. You can use this guide to install HumHub and create your social network or community platform as per your needs.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!