How to install Sonerezh Music Streaming Server on Ubuntu 18.04 LTS
Sonerezh is a free, open source and web-based music streaming server that can be used to access media from anywhere. It is simple, lightweight and easy to use application written in PHP and HTML5. You can add titles, albums and artists to your playlists and listen to them according to your mood. Sonerezh gives you a user management system with two access levels so that your friends could enjoy your music too.
In this tutorial, we will explain how to install Sonerezh on Ubuntu 18.04 server.
Requirements
- A server running Ubuntu 18.04.
- A non-root user with sudo privileges.
Install Apache, MariaDB and PHP
Sonerezh is a web-based application, so you will need to install Apache web server and MariaDB database server to your system. You can install them by running the following command:
sudo apt-get install apache2 mariadb-server -y
Next, you will need to add Ondrej PHP repository to your system. You can do this with the following command:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php -y
Next, update the repository and install PHP and all the required dependencies with the following command:
sudo apt-get install php7.2 php7.2-mysql php7.2-intl php7.2-cli php7.2-gd php7.2-mbstring php-pear php7.2-curl php7.2-mysqlnd php7.2-mcrypt libav-tools git -y
Once all the packages are installed, start Apache and MariaDB service and enable them to start on boot time with the following command:
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mysql
sudo systemctl enable mysql
Configure MariaDB
By default, MariaDB installation is not secure, so you will need to secure it first. You can do this with the following command:
sudo mysql_secure_installation
Answer all the questions as shown below:
Enter current password for root (enter for none): Set root password? [Y/n]: N Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Once the MariaDB is secured, log in to MariaDB shell:
mysql -u root -p
Enter your root password when prompt, then create a database and user for Sonerezh:
MariaDB [(none)]> CREATE DATABASE sonerezhdb;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON sonerezhdb.* TO ‘sonerezh’@’localhost’ IDENTIFIED BY ‘password’;
Next, flush all privileges with the following command:
MariaDB [(none)]>FLUSH PRIVILEGES;
MariaDB [(none)]>\q
Install Sonerezh
First, download the latest version of Sonerezh from Git repository with the following command:
cd /var/www/html
sudo git clone –branch master https://github.com/Sonerezh/sonerezh.git
Next, give proper permission to the Sonerezh directory with the following command:
sudo chown -R www-data:www-data /var/www/html/sonerezh
sudo chmod -R 755 /var/www/html/sonerezh
Next, create an Apache virtual host file for sonerezh with the following command:
sudo nano /etc/apache2/sites-available/sonerezh.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/sonerezh ServerName example.com <Directory /var/www/html/sonerezh/> Options FollowSymLinks AllowOverride All </Directory> ErrorLog /var/log/apache2/sonerezh-error_log CustomLog /var/log/apache2/sonerezh-access_log common </VirtualHost>
Save the file, then enable virtual host with the following command:
sudo a2ensite sonerezh
Finally, restart Apache web server to make the changes:
sudo systemctl restart apache2
Access Sonerezh
Now, open your web browser and type the URL http://example.com. You will be redirected to the following page:
Here, provide your database details and admin user details, then click on the Run button. You will be redirected to the Sonerezh login page:
Now, provide your admin username and password. Then, click on the Sign In button. You should see the Sonerezh dashboard in the following page: