CentOS 7 Minimal & Ampache 3.7 - rharmonson/richtech GitHub Wiki

CentOS 7 Minimal & Ampache 3.7

Building Ampache 3.7 on CentOS 7 using MariaDB, Apache, and PHP5


December 3, 2016; Please use the updated guide https://github.com/rharmonson/richtech/wiki/Audio-and-Video-Services-using-Ampache-3.8-on-CentOS-7.2.1511

Revised: February 4, 2015


Base OS Installation, Repos, and Configuration

Complete the CentOS 7.0 Minimal installation

Did you configure and/or enable the network interface during installation? You can review your current interfaces using ip addr. If not, use nmtui to update IPv4, DNS, routes, etc.

Setup yum repositories needed for this installation as of January 27, 2015.

EPEL Repo

# rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
# yum -y install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

Results:

Dependencies Resolved

================================================================================
 Package            Arch         Version   Repository                      Size
================================================================================
Installing:
 epel-release       noarch       7-5       /epel-release-7-5.noarch        24 k

Transaction Summary
================================================================================
Install  1 Package

nux-desktop Repo

# rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
# yum -y install http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

Results:

Dependencies Resolved

================================================================================
 Package        Arch   Version     Repository                              Size
================================================================================
Installing:
 nux-dextop-release
                noarch 0-5.el7.nux /nux-dextop-release-0-5.el7.nux.noarch 3.5 k

Transaction Summary
================================================================================
Install  1 Package

###Virtual Machine If using a virtual machine, it is advisable to install Open VM Tools. You may receive a "power-on script" error unless ifconfig is installed which, oddly, is not installed by default with CentOS 7 Minimal, thus "net-tools" as part of the yum installation.

# yum -y install open-vm-tools net-tools; reboot

Results:

Dependencies Resolved

================================================================================
 Package            Arch        Version                         Repository
                                                                           Size
================================================================================
Installing:
 net-tools          x86_64      2.0-0.17.20131004git.el7        base      304 k
 open-vm-tools      x86_64      9.4.0-3.el7                     base      429 k
Installing for dependencies:
 libdnet            x86_64      1.12-13.1.el7                   base       31 k
 libicu             x86_64      50.1.2-11.el7                   base      6.9 M

Transaction Summary
================================================================================
Install  2 Packages (+2 Dependent packages)

###Update Before moving forward with installing solution specific packages, update the operating system.

# yum -y update; reboot

Results:

Dependencies Resolved

================================================================================
 Package                   Arch   Version                         Repository
                                                                           Size
================================================================================
Installing:
 kernel                    x86_64 3.10.0-123.13.2.el7             updates  29 M
Updating:
 NetworkManager            x86_64 1:0.9.9.1-29.git20140326.4dba720.el7_0
                                                                  updates 1.4 M
 NetworkManager-glib       x86_64 1:0.9.9.1-29.git20140326.4dba720.el7_0
                                                                  updates 370 k
 NetworkManager-tui        x86_64 1:0.9.9.1-29.git20140326.4dba720.el7_0
                                                                  updates 191 k
 bash                      x86_64 4.2.45-5.el7_0.4                updates 1.0 M
 bind-libs-lite            x86_64 32:9.9.4-14.el7_0.1             updates 711 k
 bind-license              noarch 32:9.9.4-14.el7_0.1             updates  79 k
 ca-certificates           noarch 2014.1.98-70.0.el7_0            updates 387 k
 centos-release            x86_64 7-0.1406.el7.centos.2.5         updates  21 k
 dhclient                  x86_64 12:4.2.5-27.el7.centos.2        updates 276 k
 dhcp-common               x86_64 12:4.2.5-27.el7.centos.2        updates 170 k
 dhcp-libs                 x86_64 12:4.2.5-27.el7.centos.2        updates 126 k
 dracut                    x86_64 033-161.el7_0.173               updates 297 k
 dracut-config-rescue      x86_64 033-161.el7_0.173               updates  42 k
 dracut-network            x86_64 033-161.el7_0.173               updates  79 k
 ethtool                   x86_64 2:3.8-4.el7_0                   updates 108 k
 glibc                     x86_64 2.17-55.el7_0.5                 updates 3.6 M
 glibc-common              x86_64 2.17-55.el7_0.5                 updates  11 M
 gnutls                    x86_64 3.1.18-10.el7_0                 updates 609 k
 initscripts               x86_64 9.49.17-1.el7_0.1               updates 422 k
 iwl100-firmware           noarch 39.31.5.1-35.el7_0              updates 143 k
 iwl1000-firmware          noarch 1:39.31.5.1-35.el7_0            updates 207 k
 iwl105-firmware           noarch 18.168.6.1-35.el7_0             updates 228 k
 iwl135-firmware           noarch 18.168.6.1-35.el7_0             updates 237 k
 iwl2000-firmware          noarch 18.168.6.1-35.el7_0             updates 230 k
 iwl2030-firmware          noarch 18.168.6.1-35.el7_0             updates 239 k
 iwl3160-firmware          noarch 22.0.7.0-35.el7_0               updates 507 k
 iwl3945-firmware          noarch 15.32.2.9-35.el7_0              updates  82 k
 iwl4965-firmware          noarch 228.61.2.24-35.el7_0            updates  95 k
 iwl5000-firmware          noarch 8.83.5.1_1-35.el7_0             updates 288 k
 iwl5150-firmware          noarch 8.24.2.2-35.el7_0               updates 140 k
 iwl6000-firmware          noarch 9.221.4.1-35.el7_0              updates 160 k
 iwl6000g2a-firmware       noarch 17.168.5.3-35.el7_0             updates 303 k
 iwl6000g2b-firmware       noarch 17.168.5.2-35.el7_0             updates 304 k
 iwl6050-firmware          noarch 41.28.5.1-35.el7_0              updates 236 k
 iwl7260-firmware          noarch 22.0.7.0-35.el7_0               updates 532 k
 json-c                    x86_64 0.11-4.el7_0                    updates  31 k
 kernel-tools              x86_64 3.10.0-123.13.2.el7             updates 683 k
 kernel-tools-libs         x86_64 3.10.0-123.13.2.el7             updates 622 k
 kexec-tools               x86_64 2.0.4-32.el7.centos.5           updates 321 k
 libdb                     x86_64 5.3.21-17.el7_0.1               updates 718 k
 libdb-utils               x86_64 5.3.21-17.el7_0.1               updates 101 k
 libertas-sd8686-firmware  noarch 20140804-0.1.git6bce2b0.el7_0   updates 107 k
 libertas-sd8787-firmware  noarch 20140804-0.1.git6bce2b0.el7_0   updates 311 k
 libertas-usb8388-firmware noarch 2:20140804-0.1.git6bce2b0.el7_0 updates 107 k
 libgcc                    x86_64 4.8.2-16.2.el7_0                updates  86 k
 libgomp                   x86_64 4.8.2-16.2.el7_0                updates 119 k
 libgudev1                 x86_64 208-11.el7_0.6                  updates  48 k
 libpcap                   x86_64 14:1.5.3-3.el7_0.1              updates 137 k
 libstdc++                 x86_64 4.8.2-16.2.el7_0                updates 288 k
 libtasn1                  x86_64 3.3-5.el7_0                     updates 316 k
 libxml2                   x86_64 2.9.1-5.el7_0.1                 updates 664 k
 linux-firmware            noarch 20140804-0.1.git6bce2b0.el7_0   updates  21 M
 lzo                       x86_64 2.06-6.el7_0.2                  updates  59 k
 mariadb-libs              x86_64 1:5.5.40-2.el7_0                updates 753 k
 microcode_ctl             x86_64 2:2.1-7.1.el7_0.2               updates 490 k
 nspr                      x86_64 4.10.6-1.el7_0                  updates 125 k
 nss                       x86_64 3.16.2.3-2.el7_0                updates 826 k
 nss-softokn               x86_64 3.16.2.3-1.el7_0                updates 299 k
 nss-softokn-freebl        x86_64 3.16.2.3-1.el7_0                updates 191 k
 nss-sysinit               x86_64 3.16.2.3-2.el7_0                updates  50 k
 nss-tools                 x86_64 3.16.2.3-2.el7_0                updates 474 k
 nss-util                  x86_64 3.16.2.3-1.el7_0                updates  70 k
 openssl                   x86_64 1:1.0.1e-34.el7_0.7             updates 706 k
 openssl-libs              x86_64 1:1.0.1e-34.el7_0.7             updates 942 k
 policycoreutils           x86_64 2.2.5-11.el7_0.1                updates 801 k
 rpm                       x86_64 4.11.1-18.el7_0                 updates 1.1 M
 rpm-build-libs            x86_64 4.11.1-18.el7_0                 updates 100 k
 rpm-libs                  x86_64 4.11.1-18.el7_0                 updates 268 k
 rpm-python                x86_64 4.11.1-18.el7_0                 updates  75 k
 rsyslog                   x86_64 7.4.7-7.el7_0                   updates 556 k
 selinux-policy            noarch 3.12.1-153.el7_0.13             updates 341 k
 selinux-policy-targeted   noarch 3.12.1-153.el7_0.13             updates 3.8 M
 systemd                   x86_64 208-11.el7_0.6                  updates 2.6 M
 systemd-libs              x86_64 208-11.el7_0.6                  updates 154 k
 systemd-sysv              x86_64 208-11.el7_0.6                  updates  36 k
 tuned                     noarch 2.3.0-11.el7_0.3                updates 145 k
 tzdata                    noarch 2014j-1.el7_0                   updates 434 k
 wpa_supplicant            x86_64 1:2.0-13.el7_0                  updates 801 k
 yum-plugin-fastestmirror  noarch 1.1.31-25.el7_0                 updates  28 k

Transaction Summary
================================================================================
Install   1 Package
Upgrade  79 Packages

Ampache Requirements

Requirements as described here: https://github.com/ampache/ampache#requirements

  • A web server. All of the following have been used, though Apache receives the most testing:
    • Apache
    • lighttpd
    • nginx
    • IIS
  • PHP 5.4 or greater.
  • PHP modules:
    • PDO
    • PDO_MYSQL
    • hash
    • session
    • json
    • simplexml (This is not strictly necessary, but may result in a better experience.)
    • curl (This is not strictly necessary, but may result in a better experience.)
  • MySQL 5.x

  • MySQL Database 5.x: A bit of a departure, but I am going to use MariaDB versus MySQL. MariaDB is in-place replacement for MySQL.

    • mariadb
    • mariadb-server
  • Web Services:

    • httpd (aka Apache)
  • PHP 5.4:

    • php
    • php-common
    • php-mcrypt
    • php-pdo
    • php-cli
    • php-mysql
    • php-gd
    • php-xml
  • Encryption:

    • libmcrypt
  • (de)codec/r:

    • ffmpeg
  • Utility:

    • git; for obtaining ampache from github
    • links; for testing on ampache host, text web browser

Notes:

  1. curl, json, and libxml2 are installed by default for CentOS 7 Minimal installation.
  2. php-common provides many of the requirements including but not limited to php-hash and php-session.
  3. many of the packages below are inter-dependent but for clarity, I specify them.

Execute the following:

# yum -y install mariadb mariadb-server httpd php php-common php-mcrypt php-pdo php-cli php-mysql php-gd php-xml libmcrypt ffmpeg git links

Results:

Dependencies Resolved

================================================================================
 Package                 Arch   Version                        Repository  Size
================================================================================
Installing:
 ffmpeg                  x86_64 2.3.4-1.el7.nux                nux-dextop 1.5 M
 git                     x86_64 1.8.3.1-4.el7                  base       4.3 M
 httpd                   x86_64 2.4.6-19.el7.centos            updates    2.7 M
 libmcrypt               x86_64 2.5.8-13.el7                   epel        99 k
 links                   x86_64 1:2.8-2.el7                    epel       1.9 M
 mariadb                 x86_64 1:5.5.40-2.el7_0               updates    8.9 M
 mariadb-server          x86_64 1:5.5.40-2.el7_0               updates     11 M
 php                     x86_64 5.4.16-23.el7_0.3              updates    1.3 M
 php-cli                 x86_64 5.4.16-23.el7_0.3              updates    2.7 M
 php-common              x86_64 5.4.16-23.el7_0.3              updates    561 k
 php-gd                  x86_64 5.4.16-23.el7_0.3              updates    124 k
 php-mcrypt              x86_64 5.4.16-2.el7                   epel        19 k
 php-mysql               x86_64 5.4.16-23.el7_0.3              updates     97 k
 php-pdo                 x86_64 5.4.16-23.el7_0.3              updates     95 k
 php-xml                 x86_64 5.4.16-23.el7_0.3              updates    122 k
Installing for dependencies:
 SDL                     x86_64 1.2.15-11.el7                  base       204 k
 apr                     x86_64 1.4.8-3.el7                    base       103 k
 apr-util                x86_64 1.5.2-6.el7                    base        92 k
 enca                    x86_64 1.14-1.el7                     epel       106 k
 ffmpeg-libs             x86_64 2.3.4-1.el7.nux                nux-dextop 4.8 M
 flac-libs               x86_64 1.3.0-4.el7                    base       169 k
 fontconfig              x86_64 2.10.95-7.el7                  base       228 k
 fontpackages-filesystem noarch 1.44-8.el7                     base       9.9 k
 fribidi                 x86_64 0.19.4-6.el7                   base        63 k
 gpm-libs                x86_64 1.20.7-5.el7                   base        32 k
 graphite2               x86_64 1.2.2-5.el7                    base        81 k
 gsm                     x86_64 1.0.13-11.el7                  base        30 k
 harfbuzz                x86_64 0.9.20-3.el7                   base       144 k
 httpd-tools             x86_64 2.4.6-19.el7.centos            updates     78 k
 jbigkit-libs            x86_64 2.0-11.el7                     base        46 k
 lame-libs               x86_64 3.99.5-2.el7                   nux-dextop 339 k
 libICE                  x86_64 1.0.8-7.el7                    base        63 k
 libSM                   x86_64 1.2.1-7.el7                    base        38 k
 libX11                  x86_64 1.6.0-2.1.el7                  base       605 k
 libX11-common           noarch 1.6.0-2.1.el7                  base       181 k
 libXau                  x86_64 1.0.8-2.1.el7                  base        29 k
 libXdamage              x86_64 1.1.4-4.1.el7                  base        20 k
 libXext                 x86_64 1.3.2-2.1.el7                  base        38 k
 libXfixes               x86_64 5.0.1-2.1.el7                  base        18 k
 libXi                   x86_64 1.7.2-2.1.el7                  base        39 k
 libXpm                  x86_64 3.5.10-5.1.el7                 base        52 k
 libXtst                 x86_64 1.2.2-2.1.el7                  base        20 k
 libXv                   x86_64 1.0.9-2.1.el7                  base        18 k
 libXxf86vm              x86_64 1.1.3-2.1.el7                  base        17 k
 libaio                  x86_64 0.3.109-12.el7                 base        24 k
 libass                  x86_64 0.12.0-1.el7                   epel        78 k
 libasyncns              x86_64 0.8-7.el7                      base        26 k
 libcdio                 x86_64 0.92-1.el7                     base       235 k
 libcdio-paranoia        x86_64 10.2+0.90-11.el7               base        70 k
 libdc1394               x86_64 2.2.2-3.el7                    epel       121 k
 libgnome-keyring        x86_64 3.8.0-3.el7                    base       109 k
 libjpeg-turbo           x86_64 1.2.90-5.el7                   base       134 k
 libogg                  x86_64 2:1.3.0-7.el7                  base        24 k
 libpng                  x86_64 2:1.5.13-5.el7                 base       212 k
 libraw1394              x86_64 2.1.0-2.el7                    base        63 k
 libsndfile              x86_64 1.0.25-9.el7                   base       149 k
 libtheora               x86_64 1:1.1.1-8.el7                  base       136 k
 libtiff                 x86_64 4.0.3-14.el7                   base       167 k
 libusbx                 x86_64 1.0.15-4.el7                   base        50 k
 libv4l                  x86_64 0.9.5-4.el7                    base       194 k
 libva                   x86_64 1.2.1-3.el7                    epel        68 k
 libvdpau                x86_64 0.9-1.el7                      epel        32 k
 libvorbis               x86_64 1:1.3.3-8.el7                  base       204 k
 libxcb                  x86_64 1.9-5.el7                      base       169 k
 libxslt                 x86_64 1.1.28-5.el7                   base       242 k
 libzip                  x86_64 0.10.1-8.el7                   base        48 k
 mailcap                 noarch 2.1.41-2.el7                   base        31 k
 mesa-filesystem         x86_64 9.2.5-6.20131218.el7_0         updates     22 k
 mesa-libEGL             x86_64 9.2.5-6.20131218.el7_0         updates     69 k
 mesa-libGL              x86_64 9.2.5-6.20131218.el7_0         updates    142 k
 mesa-libgbm             x86_64 9.2.5-6.20131218.el7_0         updates     30 k
 mesa-libglapi           x86_64 9.2.5-6.20131218.el7_0         updates     34 k
 openal-soft             x86_64 1.16.0-2.el7                   epel       282 k
 openjpeg-libs           x86_64 1.5.1-9.el7                    base        84 k
 opus                    x86_64 1.0.2-6.el7                    base       630 k
 orc                     x86_64 0.4.17-5.el7                   base       164 k
 perl                    x86_64 4:5.16.3-283.el7               base       8.0 M
 perl-Carp               noarch 1.26-244.el7                   base        19 k
 perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7                    base        32 k
 perl-Compress-Raw-Zlib  x86_64 1:2.061-4.el7                  base        57 k
 perl-DBD-MySQL          x86_64 4.023-5.el7                    base       140 k
 perl-DBI                x86_64 1.627-4.el7                    base       802 k
 perl-Data-Dumper        x86_64 2.145-3.el7                    base        47 k
 perl-Encode             x86_64 2.51-7.el7                     base       1.5 M
 perl-Error              noarch 1:0.17020-2.el7                base        32 k
 perl-Exporter           noarch 5.68-3.el7                     base        28 k
 perl-File-Path          noarch 2.09-2.el7                     base        26 k
 perl-File-Temp          noarch 0.23.01-3.el7                  base        56 k
 perl-Filter             x86_64 1.49-3.el7                     base        76 k
 perl-Getopt-Long        noarch 2.40-2.el7                     base        56 k
 perl-Git                noarch 1.8.3.1-4.el7                  base        52 k
 perl-HTTP-Tiny          noarch 0.033-3.el7                    base        38 k
 perl-IO-Compress        noarch 2.061-2.el7                    base       260 k
 perl-Net-Daemon         noarch 0.48-5.el7                     base        51 k
 perl-PathTools          x86_64 3.40-5.el7                     base        82 k
 perl-PlRPC              noarch 0.2020-14.el7                  base        36 k
 perl-Pod-Escapes        noarch 1:1.04-283.el7                 base        49 k
 perl-Pod-Perldoc        noarch 3.20-4.el7                     base        87 k
 perl-Pod-Simple         noarch 1:3.28-4.el7                   base       216 k
 perl-Pod-Usage          noarch 1.63-3.el7                     base        27 k
 perl-Scalar-List-Utils  x86_64 1.27-248.el7                   base        36 k
 perl-Socket             x86_64 2.010-3.el7                    base        49 k
 perl-Storable           x86_64 2.45-3.el7                     base        77 k
 perl-TermReadKey        x86_64 2.30-20.el7                    base        31 k
 perl-Text-ParseWords    noarch 3.29-4.el7                     base        14 k
 perl-Time-Local         noarch 1.2300-2.el7                   base        24 k
 perl-constant           noarch 1.27-2.el7                     base        19 k
 perl-libs               x86_64 4:5.16.3-283.el7               base       686 k
 perl-macros             x86_64 4:5.16.3-283.el7               base        42 k
 perl-parent             noarch 1:0.225-244.el7                base        12 k
 perl-podlators          noarch 2.5.1-3.el7                    base       112 k
 perl-threads            x86_64 1.87-4.el7                     base        49 k
 perl-threads-shared     x86_64 1.43-6.el7                     base        39 k
 pulseaudio-libs         x86_64 3.0-22.el7                     base       555 k
 rsync                   x86_64 3.0.9-15.el7                   base       359 k
 schroedinger            x86_64 1.0.11-4.el7                   epel       291 k
 soxr                    x86_64 0.1.1-3.el7                    epel        77 k
 speex                   x86_64 1.2-0.19.rc1.el7               base        98 k
 t1lib                   x86_64 5.1.2-14.el7                   base       166 k
 x264-libs               x86_64 0.142-7.20140728gitaf8e768.el7.nux
                                                               nux-dextop 568 k
 xvidcore                x86_64 1.3.2-5.el7.nux                nux-dextop 258 k

Transaction Summary
================================================================================
Install  15 Packages (+106 Dependent packages)

##Database Configuration

Enable MariaDB

# systemctl enable mariadb

Start MariaDB

# systemctl start mariadb

Configure MariaDB Run the script below and, generally, accept the defaults.

# mysql_secure_installation  

##Apache Configuration Apache works out of the box, so no initial configuration needed.

Enable Apache

# systemctl enable httpd  

Start Apache

# systemctl start httpd  

##PHP Configuration Increase your max upload, upload_max_filesize, size in /etc/php.ini to 20MB or more. The max post, post_max_size, must be more than the upload_max_filesize.

# vi /etc/php.ini

upload_max_filesize = 20M  
post_max_size = 40M  

Restart httpd to update with configuration changes.

# systemctl restart httpd 

##Firewall After install of CentOS 7, we are using firewalld not iptables. A departure from CentOS 6.x which is unsettling. If you prefer to use iptables, excellent instructions to remove firewalld and install iptables are found here under sections 4.5.9 and 4.5.10: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html

I am going to be adventuresome and use firewalld.

List existing firewall rules for public, the default zone.

# firewall-cmd --zone=public --list-all

Results:

public (default, active)
  interfaces: ens32
  sources:
  services: dhcpv6-client ssh
  ports:
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

Add rules to permit http and https traffic.

# firewall-cmd --permanent --zone=public --add-service=http --add-service=https

Results:

Success

Reload to apply the new rules.

# firewall-cmd --reload

Results:

Success

Check your work.

# firewall-cmd --zone=public --list-all

Results:

public (default, active)
  interfaces: ens32
  sources:
  services: dhcpv6-client http https ssh
  ports:
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

##SELinux Update selinux's configuration file from enforcing to permissive. If selinux is set for enforcing, ampache.cfg.php will not be writable. Setting selinux to permissive will permit writing to ampache.cfg.php during initial setup via Ampache's portal.

# setenforce permissive

Verify either by inspection using # cat /etc/selinux/config or executing

# sestatus

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          permissive
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

Once setup and basic configuraition is complete, advise updating using setenforce enforcing to not permit unauthorized changes to ampache.cfg.php.

Ampache Installation

Enter the web server root directory

# cd /var/www/html

Clone ampache from github

# git clone https://github.com/ampache/ampache.git

Results:

Cloning into 'ampache'...
remote: Counting objects: 46403, done.
remote: Compressing objects: 100% (109/109), done.
remote: Total 46403 (delta 39), reused 0 (delta 0)
Receiving objects: 100% (46403/46403), 96.63 MiB | 827.00 KiB/s, done.
Resolving deltas: 100% (33300/33300), done.

Grant the web server privileges to the ampache directory.

# chown -R apache.apache ampache/

Ampache Configuration

In theory, Ampache is ready for configuration and testing. Open your browser and use the URL http://<IP-or-Hostname>/ampache and walk through the process to configure. If you run into challenges, check your work!

=== This document is a work in progress.

Items for the author to expand upon:

  1. mounting shares.
  2. creating catalogs.
  3. amapache configuration for trans-coding.
  4. last.fm integration.
  5. testing and trouble shooting.