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:

Database configuration

Username and password

Here, provide your database details and admin user details, then click on the Run button. You will be redirected to the Sonerezh login page:

Sign in to Sonerezh

Now, provide your admin username and password. Then, click on the Sign In button. You should see the Sonerezh dashboard in the following page:

Sonerezh Dashboard

Sonerezh song list

Share this page:

Suggested articles

5 Comment(s)

Add comment

Comments

By: ustoopia at: 2018-09-14 14:44:06

When I want to open Sonerezh nothing happens. Error log shows the following:

[Fri Sep 14 16:38:29.131052 2018] [:error] [pid 7744] [client 192.168.2.10:16040] FastCGI: server "/var/www/web17/cgi-bin/php-fcgi-*-443-stream.mydomain.nl" stderr: PHP message: PHP Fatal error:  CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your /cake core directory and your /vendors root directory. in /var/www/web17/web/sonerezh/app/webroot/index.php on line 99I havent investigated this myself yet but it looks to me that I also have to install CakePHP or something related

By: sanled at: 2018-10-21 21:36:00

Some listed packages are not available in the repository of ubuntu 18.04

By: till at: 2018-10-22 07:42:37

Check that you have all Ubuntu repositories enabled incl. universe and multiverse.

By: Sam at: 2018-12-21 13:26:41

I followed exactly your instructions.

But I get the following error message:

sudo apt-get install php7.2-mcrypt libav-toolsPaketlisten werden gelesen... FertigAbhängigkeitsbaum wird aufgebaut.       Statusinformationen werden eingelesen.... FertigPaket libav-tools ist nicht verfügbar, wird aber von einem anderen Paketreferenziert. Das kann heißen, dass das Paket fehlt, dass es abgelöstwurde oder nur aus einer anderen Quelle verfügbar ist.Doch die folgenden Pakete ersetzen es:  ffmpegE: Paket php7.2-mcrypt kann nicht gefunden werden.E: Mittels des Musters »php7.2-mcrypt« konnte kein Paket gefunden werden.E: Mittels regulärem Ausdruck »php7.2-mcrypt« konnte kein Paket gefunden werden.E: Für Paket »libav-tools« existiert kein Installationskandidat.

 

Error Log of Apache:

cat sonerezh-error.log [Fri Dec 21 14:19:13.972762 2018] [php7:error] [pid 21578] [client 192.168.111.32:36634] PHP Fatal error:  CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your /cake core directory and your /vendors root directory. in /var/www/html/sonerezh/app/webroot/index.php on line 99

By: Sam at: 2018-12-28 20:52:23

I manged it now. This are my installation instrutctions for Ubuntu 18.04 and Sonerezh 1.2.4

sudo apt updatesudo apt install apache2 mariadb-server php php-mysql php-gd php php-intl php-cli php-mbstring php-pear php-curlcd /var/www/html/sudo git clone https://github.com/Sonerezh/sonerezh.gitsudo chown -R [yourCurrentUser]: /var/www/html/sonerezhcd /var/www/html/sonerezhphp -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"php composer-setup.phpphp composer.phar installln -s app/Vendor/sudo chown -R www-data: /var/www/html/sonerezhsudo chmod -R 755 /var/www/html/sonerezhsudo nano /etc/apache2/sites-available/sonerezh.conf----------Listen 8888<VirtualHost *:8888>    ServerAdmin cubietruck    DocumentRoot /var/www/html/sonerezh        <Directory /var/www/html/sonerezh/>        Options FollowSymLinks        AllowOverride All        # Apache 2.2.x        <IfModule !mod_authz_core.c>            Order Allow,Deny            Allow from all        </IfModule>        # Apache 2.4.x        <IfModule mod_authz_core.c>            Require all granted        </IfModule>    </Directory>    CustomLog /var/log/apache2/sonerezh-access.log "Combined"    ErrorLog /var/log/apache2/sonerezh-error.log</VirtualHost>----------sudo a2ensite sonerezh.confsudo a2enmod rewritesudo systemctl restart apache2sudo mysql -u root -pmysql> CREATE DATABASE sonerezh;mysql> GRANT ALL PRIVILEGES ON sonerezh.* TO 'sonerezh'@'localhost' IDENTIFIED BY '<changeme>';mysql> FLUSH PRIVILEGES;exit;