当前位置: 首页 > 工具软件 > Ampache > 使用案例 >

如何在Ubuntu 18.04上安装Ampache Music Streaming Server

朱华皓
2023-12-01

The author selected Open Internet/Free Speech Fund to receive a donation as part of the Write for DOnations program.

作者选择了“ 开放互联网/言论自由基金会”作为“ Write for DOnations”计划的一部分来接受捐赠。

介绍 (Introduction)

Ampache is an open-source music streaming server that allows you to host and manage your digital music collection on your own server. Ampache can stream your music to your computer, smartphone, tablet, or smart TV. This means that you don’t have to maintain multiple copies of your music on the device you want to use to listen to it. With Ampache you can manage your collection on your server using Ampache’s web interface and listen to it anywhere.

Ampache是一种开源音乐流服务器,它允许您在自己的服务器上托管和管理数字音乐收藏。 Ampache可以将音乐流式传输到计算机,智能手机,平板电脑或智能电视。 这意味着您不必在要用来收听音乐的设备上维护音乐的多个副本。 使用Ampache,您可以使用Ampache的Web界面在服务器上管理收藏集,并在任何地方收听。

In this tutorial, you will install and configure the Apache webserver and PHP that will serve your Ampache instance. You will then create a MySQL database that Ampache will use to store all of its operational information. Finally you will upload your music collection so you can start streaming your music.

在本教程中,您将安装和配置将为Ampache实例提供服务的Apache Web服务器和PHP。 然后,您将创建一个MySQL数据库,Ampache将使用该数据库来存储其所有操作信息。 最后,您将上传音乐收藏,以便可以开始流音乐。

先决条件 (Prerequisites)

Before you begin this guide you’ll need the following:

在开始本指南之前,您需要满足以下条件:

第1步-安装Ampache (Step 1 — Installing Ampache)

In this step, you will download the Ampache ZIP archive to your server, unpack it to its installation home directory, and make some necessary file system changes.

在此步骤中,您将把Ampache ZIP存档下载到您的服务器,将其解压缩到其安装主目录,并进行一些必要的文件系统更改。

First, log in to your server as the non-root user. Then create Ampache’s home directory with the following command:

首先,以非root用户身份登录到服务器。 然后使用以下命令创建Ampache的主目录:

  • sudo mkdir /var/www/ampache

    须藤mkdir / var / www / ampache

Next, install the zip utility that you will need to unpack the Ampache archive:

接下来,安装解压缩Ampache归档文件所需的zip实用程序:

  • sudo apt install zip

    sudo apt安装zip

Next, download the ZIP archive of the latest release. You can find the link to the latest release on Ampache’s GitHub page. In these examples, version 4.1.1 is used:

接下来,下载最新版本的ZIP存档。 您可以在Ampache的GitHub页面上找到最新版本的链接。 在这些示例中,使用版本4.1.1

  • wget https://github.com/ampache/ampache/releases/download/4.1.1/ampache-4.1.1_all.zip

    wget https://github.com/ampache/ampache/releases/download/ 4.1.1 / ampache- 4.1.1 _all.zip

Next, unpack the ZIP archive into the /var/www/ampache/ directory using the -d option:

接下来,使用-d选项将ZIP归档文件解压缩到/var/www/ampache/目录中:

  • sudo unzip ampache-4.1.1_all.zip -d /var/www/ampache/

    sudo解压缩ampache-4.1.1_all.zip -d / var / www / ampache /

Next, set the user and group identity of Ampache’s files so that Apache is able to read, write, and execute the Ampache instance files:

接下来,设置Ampache文件的用户和组标识,以便Apache能够读取,写入和执行Ampache实例文件:

  • sudo chown --recursive www-data:www-data /var/www/ampache/

    sudo chown-递归www-data:www-data / var / www / ampache /

The --recursive option makes chown change the ownership and group identity of all the files and subdirectory under /var/www/ampache/ to Apache’s user and group www-data.

--recursive选项使chown/var/www/ampache/下的所有文件和子目录的所有权和组标识更改为Apache的用户和组www-data

Next, rename the .htaccess files that are included in the ZIP archive. .htaccess files contain security and other operation information for Apache but they will only work with the file extension name .htaccess. Rename the supplied .htaccess.dist files to .htaccess with the following commands:

接下来,重命名ZIP存档中包含的.htaccess文件。 .htaccess文件包含有关Apache的安全性和其他操作信息,但它们只能与文件扩展名.htaccess 。 使用以下命令将提供的.htaccess.dist文件重命名为.htaccess

  • sudo mv /var/www/ampache/rest/.htaccess.dist /var/www/ampache/rest/.htaccess

    须藤MV /var/www/ampache/rest/.htaccess.dist /var/www/ampache/rest/.htaccess
  • sudo mv /var/www/ampache/play/.htaccess.dist /var/www/ampache/play/.htaccess

    须藤MV /var/www/ampache/play/.htaccess.dist /var/www/ampache/play/.htaccess
  • sudo mv /var/www/ampache/channel/.htaccess.dist /var/www/ampache/channel/.htaccess

    须藤MV /var/www/ampache/channel/.htaccess.dist /var/www/ampache/channel/.htaccess

Now you’ll create the directory that will contain your music files. For security reasons, this directory is best created outside of Ampache’s installation directory. That way, it will not be readable or changeable by malicious web requests as it resides outside of Ampache’s DocumentRoot.

现在,您将创建包含音乐文件的目录。 出于安全考虑,最好在Ampache的安装目录之外创建此目录。 这样,它就不会被恶意Web请求读取或更改,因为它位于Ampache的DocumentRoot

Create the directory, /data/Music, with the following command:

使用以下命令创建目录/data/Music

  • sudo mkdir -p /data/Music

    须藤mkdir -p / data /音乐

Then change its owner and group identity so that Apache can read and write to it:

然后更改其所有者和组标识,以便Apache可以对其进行读写:

  • sudo chown www-data:www-data /data/Music

    须藤弦www-data:www-data / data / Music

To finish setting up, you’ll install FFmpeg, which is a utility that converts audio and video from one format to another. For example, you could use it to convert an MP3 music file to an OPUS music file. Ampache uses FFmpeg to convert audio on the fly from the format in which it was uploaded to a format that the listening device can play. This is a process known as transcoding.

要完成设置,您将安装FFmpeg ,这是一个将音频和视频从一种格式转换为另一种格式的实用程序。 例如,您可以使用它来将MP3音乐文件转换为OPUS音乐文件。 Ampache使用FFmpeg将音频实时地从上传的格式转换为监听设备可以播放的格式。 这是一个称为代码转换的过程。

This is useful because not all devices are able to play all formats of music. Ampache can detect what formats are supported on the playing device and automatically supply your music in the supported format.

这很有用,因为并非所有设备都能播放所有格式的音乐。 Ampache可以检测播放设备支持的格式,并以支持的格式自动提供音乐。

Install FFmpeg with the following command:

使用以下命令安装FFmpeg:

  • sudo apt install ffmpeg

    sudo apt安装ffmpeg

You’ve now unpacked and prepared your Ampache instance for the web installer and installed the FFmpeg utility. Next you’ll configure Apache and PHP to serve your Ampache instance.

现在,您已经解压缩并为Web安装程序准备了Ampache实例,并安装了FFmpeg实用程序。 接下来,您将配置Apache和PHP以服务您的Ampache实例。

第2步-配置Apache和PHP (Step 2 — Configuring Apache and PHP)

In this section, you will configure Apache by creating a new VirtualHost file, which will provide the configuration that Apache needs to serve your Ampache server domain. You will also install some additional PHP modules that extend the abilities of PHP to cover the requirements of Ampache

在本节中,您将通过创建一个新的VirtualHost文件来配置Apache,该文件将提供Apache服务Ampache服务器域所需的配置。 您还将安装一些其他PHP模块,这些模块将扩展PHP的功能,以满足Ampache的要求。

First, install some additional PHP modules that were not included with the default PHP installation:

首先,安装默认PHP安装中未包含的一些其他PHP模块:

  • sudo apt install php-mysql php-curl php-json php-gd php7.2-xml

    sudo apt安装php-mysql php-curl php-json php-gd php7.2-xml

These modules provide the following additional functionality:

这些模块提供以下附加功能:

  • php-mysql — Enables PHP to communicate with a MySQL database.

    php-mysql使PHP与MySQL数据库通信。

  • php-curl — Enables PHP to use the curl utility to download files, such as album cover art, from remote servers.

    php-curl使PHP能够使用curl工具从远程服务器下载文件,例如专辑封面。

  • php-json — Enables PHP to read and manipulate JSON formatted text files.

    php-json使PHP能够读取和操作JSON格式的文本文件。

  • php-gd — Enables PHP to manipulate and create image files.

    php-gd使PHP能够操纵和创建图像文件。

  • php7.2-xml — Enables PHP to read and manipulate XML formatted text files.

    php7.2-xml使PHP能够读取和操作XML格式的文本文件。

Next, enable a couple of Apache modules using the a2enmod utility:

接下来,使用a2enmod实用程序启用几个Apache模块:

  • sudo a2enmod rewrite expires

    sudo a2enmod重写已过期

These Apache modules allow Apache to do the following:

这些Apache模块允许Apache执行以下操作:

  • rewrite — Modify or rewrite URLs following rules supplied by Ampache.

    rewrite -按照Ampache提供的规则修改或重写URL。

  • expires — Set the cache expiry times for objects such as images so that they are more efficiently stored by browsers.

    expires (过期时间)—设置对象(例如图像)的缓存过期时间,以便浏览器更有效地存储它们。

Now, you will create the VirtualHost file that tells Apache how and where to load the Ampache instance.

现在,您将创建VirtualHost文件,该文件告诉Apache如何以及在何处加载Ampache实例。

Note: If you created a test VirtualHost file that uses your Ampache domain name when you followed the “How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 18.04” guide you must disable it. Use the a2dissite utility to disable it:

注意:如果您遵循“如何在Ubuntu 18.04上安装Linux,Apache,MySQL,PHP(LAMP)堆栈”指南时创建了使用Ampache域名的测试VirtualHost文件,则必须禁用它。 使用a2dissite实用程序将其禁用:

  • sudo a2dissite test_virtalhost_file

    须藤a2dissite test_virtalhost_file

Now, create and open the VirtualHost file with your text editor at /etc/apache2/sites-available/ampache.conf:

现在,使用/etc/apache2/sites-available/ampache.conf的文本编辑器创建并打开VirtualHost文件:

  • sudo nano /etc/apache2/sites-available/ampache.conf

    须藤纳米/etc/apache2/sites-available/ampache.conf

Add the following VirtualHost template into your file:

将以下VirtualHost模板添加到您的文件中:

/etc/apache2/sites-available/ampache.conf
/etc/apache2/sites-available/ampache.conf
<VirtualHost *:80>

    ServerName your_domain
    DocumentRoot /var/www/ampache

    <Directory /var/www/ampache/>
        AllowOverride All
        Require all granted
    </Directory>

    RewriteEngine on
    CustomLog /var/log/apache2/ampache.access.log common
    ErrorLog  /var/log/apache2/ampache.error.log

</VirtualHost>

You must change your_domain to the domain name that you redirected to your server. When you have finished editing this file save and exit the editor.

您必须将your_domain更改为重定向到服务器的域名。 完成此文件的编辑后,保存并退出编辑器。

The directives in this VirtualHost file are:

VirtualHost文件中的指令为:

  • ServerName — The domain name that Apache will use to serve your Ampache instance.

    ServerName -Apache将用于为您的Ampache实例提供服务的域名。

  • DocumentRoot — The file system location on your server where the Ampache instance is located. This is the same place that you unpacked the ZIP archive to in Step 1.

    DocumentRoot — Ampache实例所在的服务器上的文件系统位置。 这是在步骤1中将ZIP归档文件解压缩到的位置。

  • Directory — This section passes configuration to Apache that applies to the files and directories contained in the path.

    Directory -此部分将配置传递给Apache,该配置适用于路径中包含的文件和目录。

  • RewriteEngine — Enables the rewrite Apache module.

    RewriteEngine —启用重写Apache模块。

  • CustomLog — Creates a log file that Apache will use to record all access logs for your Ampache server.

    CustomLog创建一个日志文件,Apache将使用该日志记录Ampache服务器的所有访问日志。

  • ErrorLog — Creates a log file that Apache will use to record all error logs generated by your Ampache server.

    ErrorLog —创建一个日志文件,Apache将使用该日志记录由Ampache服务器生成的所有错误日志。

Next, check that the VirtualHost file you created does not have any errors with the apachectl utility:

接下来,使用apachectl实用程序检查您创建的VirtualHost文件是否没有任何错误:

  • sudo apachectl configtest

    须藤apachectl configtest

If your configuration does not contain any errors, you will see the following output after the command:

如果您的配置不包含任何错误,则在命令后将看到以下输出:


   
   
Output
Syntax OK

If your configuration does contain errors, the output will print the file name and line number where the error was encountered.

如果您的配置中确实包含错误,则输出将在遇到错误的地方打印文件名和行号。

Note: If you see the error:

注意:如果看到错误:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

Then you will need to edit Apache’s main configuration file at /etc/apache2/apache2.conf and add the following line:

然后,您需要在/etc/apache2/apache2.conf编辑Apache的主要配置文件,并添加以下行:

ServerName your_domain

Next, enable the new VirtualHost configuration using the a2ensite utility:

接下来,使用a2ensite实用程序启用新的VirtualHost配置:

  • sudo a2ensite ampache

    须藤a2ensite ampache

The final configuration is optional, but recommended. The default setting for file uploads in PHP is that no file greater than 2MB can be uploaded. Music files tend to be larger than this so increasing this size will allow you to use the Ampache interface to upload larger files in your music collection.

最终配置是可选的,但建议使用。 PHP中文件上传的默认设置是不能上传大于2MB的文件。 音乐文件通常大于此文件,因此增大此大小将使您可以使用Ampache界面上传音乐收藏中的较大文件。

Open /etc/php/7.2/apache2/php.ini with the following command:

使用以下命令打开/etc/php/7.2/apache2/php.ini

  • sudo nano /etc/php/7.2/apache2/php.ini

    须藤纳米/etc/php/7.2/apache2/php.ini

And change the following lines:

并更改以下行:

/etc/php/7.2/apache2/php.ini
/etc/php/7.2/apache2/php.ini
. . .
upload_max_filesize = 2M
. . .
post_max_size = 8M
. . .

To:

至:

/etc/php/7.2/apache2/php.ini
/etc/php/7.2/apache2/php.ini
. . .
upload_max_filesize = 100M
. . .
post_max_size = 110M
. . .

You will now be able to upload music files up to 100MB. Use a larger value if you intend to upload files larger than this size. Save and exit the file.

现在,您可以上传最大100MB的音乐文件。 如果要上传大于此大小的文件,请使用较大的值。 保存并退出文件。

Finally, reload your updated Apache configuration:

最后,重新加载更新的Apache配置:

  • sudo systemctl reload apache2.service

    sudo systemctl重新加载apache2.service

You’ve now configured Apache to serve Ampache over HTTP. Next you’ll obtain a TLS certificate and configure Apache to use it so you can securely access Ampache over HTTPS.

现在,您已经配置了Apache通过HTTP服务Ampache。 接下来,您将获得TLS证书并配置Apache以使用它,以便可以通过HTTPS安全地访问Ampache。

步骤3 —启用HTTPS (Step 3 — Enabling HTTPS)

In this step, you will get a free Let’s Encrypt TLS certificate using the Certbot utility, which enables HTTPS browsing. Certbot will create the certificate, automatically generate the required Apache configuration, and manage the automatic renewal of the certificate.

在此步骤中,您将使用Certbot实用程序获得免费的Let's Encrypt TLS证书,该证书可启用HTTPS浏览。 Certbot将创建证书,自动生成所需的Apache配置,并管理证书的自动续订。

This is important because every time you log in to Ampache you will send your username and password across the internet. If you are not using HTTPS then your password will be sent in plain text that can be read as it travels across the internet.

这很重要,因为每次登录Ampache时,您都会通过Internet发送用户名和密码。 如果您不使用HTTPS,那么您的密码将以纯文本形式发送,当它在Internet上传播时可以阅读。

Ubuntu’s LTS releases tend not to have the latest packages and this is true of the Certbot program. The Certbot developers maintain a dedicated Ubuntu repository, known as a PPA, so that Ubuntu users can keep an up-to-date copy of the Certbot.

Ubuntu的LTS版本往往没有最新的软件包,Certbot程序也是如此。 Certbot开发人员维护专用的Ubuntu存储库,称为PPA ,以便Ubuntu用户可以保留Certbot的最新副本。

Install the Certbot repository with the following command:

使用以下命令安装Certbot存储库:

  • sudo add-apt-repository ppa:certbot/certbot

    sudo add-apt-repository ppa:certbot / certbot

Now, install the certbot utility:

现在,安装certbot实用程序:

  • sudo apt install python-certbot-apache

    sudo apt安装python-certbot-apache

Next, use certbot to get the TLS certificate:

接下来,使用certbot获取TLS证书:

  • sudo certbot --apache -d your_domain

    sudo certbot --apache -d your_domain

The --apache option uses the Apache plugin that enables Certbot to read and configure Apache automatically. -d your_domain specifies the domain name for which you want Certbot to create the certificate.

--apache选项使用Apache插件,该插件使Certbot能够自动读取和配置Apache。 -d your_domain指定要Certbot创建证书的域名。

When you run the certbot command you will be asked a series of questions. You’ll be prompted to enter an email address and agree to the terms of service.

当您运行certbot命令时,将询问一系列问题。 系统将提示您输入电子邮件地址并同意服务条款。

If certbot successfully confirms that you control your domain, it will ask you to configure your HTTPS settings:

如果certbot成功确认您控制了域,它将要求您配置HTTPS设置:


   
   
Output
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. ------------------------------------------------------------------------------- 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. ------------------------------------------------------------------------------- Select the appropriate number [1-2] then [enter] (press 'c' to cancel):
  • No redirect: Apache will serve Ampache via HTTP and HTTPS.

    No redirect :Apache将通过HTTP和HTTPS服务Ampache。

  • Redirect: Apache will redirect any HTTP connections to HTTPS automatically. This means that your Ampache server will only be available via HTTPS. This option is the more secure and will not affect how your Ampache instance behaves. This is the recommended choice.

    Redirect :Apache将自动将所有HTTP连接重定向到HTTPS。 这意味着您的Ampache服务器将只能通过HTTPS使用。 此选项更加安全,不会影响您的Ampache实例的行为。 这是推荐的选择。

Finally, test that the auto-renewal of the certificate will take place successfully by running the following command:

最后,通过运行以下命令来测试证书的自动更新将成功进行:

  • sudo certbot renew --dry-run

    sudo certbot更新-干运行

The --dry-run option means that certbot will test a renewal attempt without making any permanent changes to your server. If the test was successful the output will include the following line:

--dry-run选项意味着certbot将测试续订尝试,而无需对服务器进行任何永久更改。 如果测试成功,输出将包含以下行:


   
   
Output
Congratulations, all renewals succeeded. The following certs have been renewed: /etc/letsencrypt/live/your_domain/fullchain.pem (success)

Apache and PHP are now ready to serve your Ampache instance. In the next step, you will create and configure Ampache’s database.

Apache和PHP现在可以为您的Ampache实例提供服务了。 在下一步中,您将创建和配置Ampache的数据库。

第4步-创建MySQL数据库 (Step 4 — Creating a MySQL Database)

Ampache uses a MySQL database to store information such as playlists, user preferences, and so on. In this step, you will create a database and MySQL user that Ampache will use to access it.

Ampache使用MySQL数据库来存储信息,例如播放列表,用户首选项等。 在此步骤中,您将创建一个数据库和Ampache将用来访问它MySQL用户。

You will need to choose three pieces of information to complete the following instructions to create Ampache’s database:

您将需要选择三项信息来完成以下创建Ampache数据库的说明:

  1. ampache_database: The name of the Ampache database.

    ampache_database :Ampache数据库的名称。

  2. database_user: The MySQL user that Ampache will use to access the database. This is not a system user and can only access the database.

    database_user :Ampache将用于访问数据库MySQL用户。 这不是系统用户,只能访问数据库。

  3. database_password: The database user’s password. Be sure to choose a secure password.

    database_password :数据库用户的密码。 确保选择一个安全密码。

Make a note of these details as you will need them later.

记下这些详细信息,以备日后使用。

First, open the interactive MySQL shell with the mysql command:

首先,使用mysql命令打开交互式MySQL shell:

  • mysql --user=root --password

    mysql --user = root --password

--user=root opens the MySQL shell as the MySQL root user and --password prompts for the root user’s password.

--user=root以MySQL root用户身份打开MySQL shell, --password提示输入root用户的密码。

The following command will create an empty database:

以下命令将创建一个空数据库:

  • CREATE DATABASE ampache_database;

    创建数据库ampache_database ;

Next, create the MySQL user:

接下来,创建MySQL用户:

  • CREATE USER 'database_user'@'localhost' IDENTIFIED BY 'database_password';

    CREATE USER 'database_user '@' localhost'的IDENTIFIED BY 'database_password';

Now, give the new user full access to the database:

现在,授予新用户对数据库的完全访问权限:

  • GRANT ALL PRIVILEGES ON ampache_database.* TO 'database_user'@'localhost';

    GRANT ALL PRIVILEGES ON ampache_database * TO 'database_user '@' localhost'的。

Finally, check that the new database exists by running the following command:

最后,通过运行以下命令来检查新数据库是否存在:

  • SHOW DATABASES;

    显示数据库;

You will see the following output:

您将看到以下输出:

+--------------------+
| Database           |
+--------------------+
| information_schema |
| ampache_database  |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

Exit the MySQL shell by entering exit;.

通过输入exit;退出MySQL shell exit;

Finally, test the database, username, and password by trying to log in to the MySQL shell with the database_user.

最后,通过尝试登录到与MySQL外壳中测试数据库,用户名和密码database_user

Enter the following command to log in to the MySQL shell as the new user:

输入以下命令以新用户身份登录MySQL Shell:

  • mysql --user=database_user --password ampache_database

    mysql --user = database_user --password ampache_database

You’ve now created the database that Ampache will use. You’ve finished your server configuration and are ready to complete the installation with the web installer.

现在,您已经创建了Ampache将使用的数据库。 您已完成服务器配置,并准备使用Web安装程序完成安装。

步骤5 —使用Web安装程序 (Step 5 — Using the Web Installer)

In this step, you will use Ampache’s web installer to finish the installation by giving Ampache the information it will need to run, such as a web interface admin user, the database details, and other settings.

在此步骤中,您将使用Ampache的Web安装程序,通过向Ampache提供它将需要运行的信息(例如Web界面管理员用户,数据库详细信息和其他设置)来完成安装。

Start the web installation by entering https://your_domain into your browser.

通过在浏览器中输入https:// your_domain开始Web安装。

选择安装语言 (Choose Installation Language)

Select Ampache’s interface language and click the Start Configuration button to continue.

选择Ampache的界面语言,然后单击开始配置按钮继续。

要求 (Requirements)

This page is where Ampache checks that the server meets its requirements. Each line on this page represents a test that the installer performs to ensure that, for example, all the required PHP modules are present and working. You’ll see every test has a green checkmark to indicate that your server is ready for Ampache.

在此页面上,Ampache会检查服务器是否满足要求。 此页面上的每一行都代表安装程序执行的一项测试,以确保例如所有必需PHP模块都存在并正常工作。 您会看到每个测试都有一个绿色的选中标记,表明您的服务器已准备好用于Ampache。

Click the Continue button to move on to the next page.

单击继续按钮转到下一页。

插入Ampache数据库 (Insert Ampache Database)

This page creates Ampache’s database if it does not exist and formats it. Fill in the fields as follows:

如果该页面不存在,它将创建Ampache的数据库并对其进行格式化。 填写以下字段:

  • Desired Database Name: ampache_database

    所需的数据库名称ampache_database

  • MySQL Hostname: localhost

    MySQL主机名localhost

  • MySQL Port (optional): <EMPTY>

    MySQL端口(可选) :<EMPTY>

  • MySQL Administrative Username: database_user

    MySQL管理用户名database_user

  • MySQL Administrative Password: database_password

    MySQL管理密码database_password

  • Create Database: <UNCHECKED>

    创建数据库 :<UNCHECKED>

  • Create Tables (ampache.sql): <CHECKED>

    创建表(ampache.sql) :<CHECKED>

  • Create Database User: <UNCHECKED>

    创建数据库用户 :<UNCHECKED>

Click the Insert Database button to continue.

单击插入数据库按钮以继续。

生成配置文件 (Generate Configuration File)

This page creates the configuration file that Ampache will use to run. Fill in the fields as follows:

该页面创建Ampache将用于运行的配置文件。 填写以下字段:

  • Web Path: <EMPTY>

    网页路径 :<EMPTY>

  • Database Name: ampache_database

    数据库名称ampache_database

  • MySQL Hostname: localhost

    MySQL主机名localhost

  • MySQL Port (optional): <EMPTY>

    MySQL端口(可选) :<EMPTY>

  • MySQL Username: database_user

    MySQL用户名database_user

  • MySQL Password: database_password

    MySQL密码database_password

  • Installation Type Leave this at the default setting.

    安装类型将此保留为默认设置。

  • Allow Transcoding Select ffmpeg from the drop-down list.

    允许转码从下拉列表中选择ffmpeg

  • Players Leave these at the default settings.

    玩家将其保留为默认设置。

Click the Create Config button to continue.

单击创建配置按钮继续。

创建管理员帐户 (Create Admin Account)

This page creates the first web interface user. This user is created with full administrative, privileges and is the one that you will use to log in and configure Ampache for the first time.

该页面创建第一个Web界面用户。 该用户具有完全的管理权限,并且是您首次用于登录和配置Ampache的用户。

Choose a username and a secure password and enter it into the Password and Confirm Password fields.

选择一个用户名和一个安全密码,然后将其输入到“ 密码”和“ 确认密码”字段中。

Click the Create Account button to continue.

单击创建帐户按钮继续。

Ampache更新 (Ampache Update)

This page will perform any administrative changes to Ampache’s database that need making. These changes are made during version upgrades but as this is a new installation the installer will not make any changes.

该页面将对Ampache的数据库进行任何需要进行的管理更改。 这些更改是在版本升级期间进行的,但是由于这是新安装,因此安装程序不会进行任何更改。

Click the Update Now! button to continue.

单击立即更新! 按钮继续。

Ampache更新 (Ampache Update)

This page prints and explains any updates that the installer made in the previous step. You should not see any updates listed.

此页面打印并说明安装程序在上一步中所做的所有更新。 您应该看不到列出任何更新。

Click the [Return to main page] link to continue to the login page. Enter your username and password you set to log in to your Ampache server.

单击[返回主页]链接以继续登录页面。 输入您设置的用户名和密码,以登录到Ampache服务器。

Ampache is not quite fully set up and ready for use. You’ll now complete the setup by adding your music so you can start using your new Ampache server.

Ampache尚未完全设置好并可以使用。 现在,您将通过添加音乐来完成设置,以便可以开始使用新的Ampache服务器。

第6步-将音乐添加到Ampache (Step 6 — Adding Your Music to Ampache)

A music server is no use without some music to play. In this step, you will configure a music catalog and upload some music. “Catalog” is the name that Ampache gives to a collection of music. Ampache is able to read music from many sources both on and off the server but in this tutorial, you will upload and store your music on the server in a local catalog, as Ampache refers to it.

没有一些音乐就无法播放音乐服务器。 在此步骤中,您将配置音乐目录并上传一些音乐。 “目录”是Ampache代表音乐收藏的名称。 Ampache可以从服务器上和服务器外的许多来源读取音乐,但是在本教程中,您将按照Ampache的说明将音乐上载并存储在服务器的本地目录中。

First, click the add a Catalog link in the following line on the first page that you see when you log in to Ampache:

首先,在您登录Ampache时看到的第一页的以下行中,单击添加目录链接:

No Catalog configured yet. To start streaming your media, you now need to add a Catalog.

尚未配置目录。 要开始流式传输媒体,现在需要添加目录。

This will take you to the Add Catalog page. Fill in the fields as follows:

这将带您到“ 添加目录”页面。 填写以下字段:

  • Catalog Name: Give this catalog a short, memorable name.

    目录名称: Give this catalog a short, memorable name.

  • Catalog Type: local

    目录类型: local

  • Filename Pattern: <EMPTY>

    文件名模式: <EMPTY>

  • Folder Pattern: Leave this with the defaults.

    文件夹模式:保留默认值。

  • Gather Art: <CHECKED>

    收集艺术: <已检查>

  • Build Playlists from Playlist Files. (m3u, m3u8, asx, pls, xspf): <UNCHECKED>

    从播放列表文件构建播放列表。 (m3u,m3u8,asx,pls,xspf): <UNCHECKED>

  • Path: /data/Music

    路径: /data/Music

Click the Add Catalog button to complete this page.

单击添加目录按钮以完成此页面。

On the page that follows click the Continue button. This will take you to the Show Catalogs page that will print the details for the catalog you created. You can change the catalog settings at any time in the future.

在随后的页面上,单击继续按钮。 这将带您进入“ 显示目录”页面,该页面将打印您创建的目录的详细信息。 您将来可以随时更改目录设置。

Now, enable Ampache’s web upload facility by clicking on the third navigation icon to open the extended settings:

现在,通过单击第三个导航图标以打开扩展设置,启用Ampache的Web上传功能:

Scroll down to the Server Config section and click the System link to open the system settings page.

向下滚动到“ 服务器配置”部分,然后单击“ 系统”链接以打开系统设置页面。

Find the Allow user uploads line and select Enable from the drop-down menu in the Value column.

找到“ 允许用户上传”行,然后从“值”列的下拉菜单中选择“ 启用”

You can also choose what level of user is able to upload music files. The default level is Catalog Manager, this allows the Catalog Manager and all users with greater privileges to upload music. In this case, that is the administrator.

您还可以选择能够上传音乐文件的用户级别。 默认级别是Catalog Manager ,这允许Catalog Manager和所有具有更大特权的用户上载音乐。 在这种情况下,就是管理员。

You also need to set the catalog to which the music will get added. Set this using the Destination catalog line. Select the catalog you created in the Value drop-down.

您还需要设置要添加音乐的目录。 使用“ 目标目录”行进行设置。 在“ 值”下拉列表中选择您创建的目录。

Click the Update Preferences button at the bottom of the page to complete the configuration. You are now ready to upload some music.

单击页面底部的“ 更新首选项”按钮以完成配置。 现在您可以上传一些音乐了。

First, click the first settings icon:

首先,单击第一个设置图标:

Then click the Upload link in the Music section.

然后,点击音乐部分中的上传链接。

On the Upload page, click the Browse button and locate your music files on your computer and upload them.

在“上载”页面上,单击“ 浏览”按钮,然后在计算机上找到您的音乐文件并将其上传。

If you leave the Artist and Album labels blank then Ampache will read the ID3 tags of the music files to discover the artist and album automatically. After you have uploaded some music you will now be able to find it by clicking on the Songs, Albums, or Artists links in the Music section in the navigation panel on the left.

如果将“ 艺术家”和“ 唱片集”标签留为空白,则Ampache将读取音乐文件的ID3标签以自动发现艺术家和唱片集。 上传一些音乐后,现在可以通过单击左侧导航面板中“ 音乐”部分中的“ 歌曲” ,“ 专辑 ”或“ 艺术家”链接来找到它。

Your Ampache music server is now ready to start streaming your music.

您的Ampache音乐服务器现在可以开始流式传输音乐了。

结论 (Conclusion)

In this article, you installed and configured an Ampache music streaming server and uploaded some of your music. You can now listen to your music wherever you go on any of your devices. Ampache’s Documentation will help you use and extend your streaming server. These Android apps and this iOS app will stream your music to your phone. Ampache organizes your music on the server using the ID3 tags in the music files. The MusicMrainz program will help you manage the ID3 tags of your music files.

在本文中,您安装并配置了Ampache音乐流服务器,并上传了一些音乐。 您现在可以在任何设备上的任何地方收听音乐。 Ampache的文档将帮助您使用和扩展流服务器。 这些Android应用程序和此iOS应用程序会将您的音乐流式传输到手机。 Ampache使用音乐文件中的ID3标签在服务器上组织您的音乐。 MusicMrainz程序将帮助您管理音乐文件的ID3标签。

翻译自: https://www.digitalocean.com/community/tutorials/how-to-install-the-ampache-music-streaming-server-on-ubuntu-18-04

 类似资料: