GNU Social is a free and open-source microblogging software that allows users to create their own social network. In this tutorial, we will guide you on how to install GNU Social on Ubuntu Server Latest.
Before we start with the installation, there are a few prerequisites that need to be met:
GNU Social is available on GitHub, so we need to install Git to download the source code. To install Git, run the following command:
sudo apt update
sudo apt install git
After Git has been installed, we can now clone the GNU Social repository. Change your current directory to the document root of your web server and then clone the repository with the following command:
cd /var/www/html/
sudo git clone https://github.com/cooperativa-pasajera/dyro-social.git gnusocial
GNU Social relies on various dependencies like PHP, MySQL, and others. We can install these dependencies using apt-get. Run the following command to install the dependencies:
sudo apt install php7.4 php7.4-mysql php7.4-xml php7.4-curl php7.4-mbstring php7.4-zip php7.4-intl
Next, we need to configure Apache to serve GNU Social. Create a new virtual host file for GNU Social with the following command:
sudo nano /etc/apache2/sites-available/gnusocial.conf
Add the following configuration in the file:
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /var/www/html/gnusocial/
<Directory /var/www/html/gnusocial/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/gnusocial_error.log
CustomLog ${APACHE_LOG_DIR}/gnusocial_access.log combined
</VirtualHost>
Save and close the file. Then, enable the virtual host with the following command:
sudo a2ensite gnusocial.conf
Restart Apache for the changes to take effect:
sudo systemctl restart apache2
GNU Social stores its data in a MySQL database. We need to create a new database and user for GNU Social. Log in to the MySQL shell with the following command:
sudo mysql -u root -p
Create a new database and user with the following commands:
mysql> CREATE DATABASE gnusocial;
mysql> CREATE USER 'gnusocial'@'localhost' IDENTIFIED BY 'your-password';
mysql> GRANT ALL PRIVILEGES ON gnusocial . * TO 'gnusocial'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit;
Make sure to replace the your-password
with a secure password of your choice.
GNU Social needs to be configured before we can use it. Go to the installation directory of GNU Social:
cd /var/www/html/gnusocial/
Copy the default configuration file:
sudo cp config.php.sample config.php
Edit the configuration file with the following command:
sudo nano config.php
Set the database configuration as follows:
define('DB_TYPE', 'mysqli');
define('DB_HOST', 'localhost');
define('DB_PORT', '3306');
define('DB_USER', 'gnusocial');
define('DB_PASS', 'your-password');
define('DB_NAME', 'gnusocial');
Save and close the file.
After the configuration has been set, we need to run the install script to set up the database schema. Run the following command:
sudo php scripts/install.php
GNU Social should now be installed on your server. You can access it by visiting the server's hostname or IP address in your web browser.
Before using GNU Social, there are a few final checks that need to be performed:
Make sure that Apache, MySQL, and PHP are running.
Set appropriate file permissions on the GNU Social directory with the following command:
sudo chown -R www-data:www-data /var/www/html/gnusocial/
Congratulations, you have successfully installed GNU Social on Ubuntu Server Latest!
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!