如何在 Ubuntu 16.04 上安装 4images Gallery

在本教程中,我们将向您展示如何在您的 Ubuntu 16.04 服务器上安装和配置 4images Gallery。 对于那些不知道的人,4images 是一个照片库,您可以在其中上传和管理您的艺术作品、照片和其他图像。 这非常适合显示您的相册、艺术画廊,甚至分发桌面壁纸供访问者下载。 4images Gallery 可免费用于私人和非商业用途。

本文假设您至少具备 Linux 的基本知识,知道如何使用 shell,最重要的是,您将网站托管在自己的 VPS 上。 安装非常简单,假设您在 root 帐户下运行,如果不是,您可能需要添加 ‘sudo’ 到命令以获取 root 权限。 我将向您展示在 Ubuntu 16.04 服务器上逐步安装 4images Gallery。

在 Ubuntu 16.04 上安装 4images Gallery

步骤 1. 首先,通过在终端中运行以下 apt-get 命令,确保所有系统包都是最新的。

sudo apt-get update sudo apt-get upgrade

步骤 2. 安装 LAMP (Linux, ApacheMariaDB, PHP) 服务器。

需要 Ubuntu 16.04 LAMP 服务器。 如果您没有安装 LAMP,您可以在此处按照我们的指南进行操作。 此外,安装所有必需的 PHP 模块:

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-mysql php5-gd php5-curl

步骤 3. 在 Ubuntu 上安装 4images Gallery。

首先要做的就是去 4images Gallery 的下载页面 并下载 4images Gallery 的最新稳定版本,在撰写本文时它是 1.7.13 版本。

将 4images Gallery 存档解压缩到服务器上的文档根目录:

mkdir -p /var/www/html/ cd /var/www/html/ unzip 4images1.7.13.zip cd 4images cp -a * ..

我们将需要更改一些文件夹权限:

chown -R www-data: /var/www/html/

步骤 4. 为 4images Gallery 配置 MariaDB。

默认情况下,MariaDB 未加固。 您可以使用 mysql_secure_installation 脚本。 您应该仔细阅读以下每个步骤,这些步骤将设置 root 密码、删除匿名用户、禁止远程 root 登录、删除测试数据库和访问安全 MariaDB:

mysql_secure_installation

像这样配置它:

- Set root password? [Y/n] y - 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

接下来,我们需要登录 MariaDB 控制台并为 4images Gallery 创建一个数据库。 运行以下命令:

mysql -u root -p

这将提示您输入密码,因此输入您的 MariaDB 根密码并点击 Enter. 登录到数据库服务器后,您需要为 4images Gallery 安装创建一个数据库:

CREATE DATABASE 4images; GRANT ALL PRIVILEGES on 4images.* to '4images_user'@'localhost' identified by 'your_password'; FLUSH PRIVILEGES; exit

步骤 4. 配置 Apache 4images Gallery 的网络服务器。

在中创建一个新的虚拟主机指令 Apache. 例如,新建一个 Apache 虚拟服务器上名为“4images.conf”的配置文件:

sudo a2enmod rewrite touch /etc/apache2/sites-available/4images.conf ln -s /etc/apache2/sites-available/4images.conf /etc/apache2/sites-enabled/4images.conf nano /etc/apache2/sites-available/4images.conf

添加以下行:

<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/ ServerName your-domain.com ServerAlias www.your-domain.com <Directory /var/www/html/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/your-domain.com-error_log CustomLog /var/log/apache2/your-domain.com-access_log common </VirtualHost>

现在,我们可以重新启动 Apache Web 服务器,以便进行更改:

systemctl restart apache2.service

步骤 6. 访问 4images 图库.

默认情况下,4images Gallery 将在 HTTP 端口 80 上可用。 打开您喜欢的浏览器并导航到 https://yourdomain.com/ 或者 https://server-ip/ 并完成所需的步骤以完成安装。 如果您使用防火墙,请打开端口 80 以启用对控制面板的访问。

恭喜! 您已成功安装 4images Gallery。 感谢您使用本教程进行安装 4images 图库 在您的 Ubuntu 16.04 系统上。 如需其他帮助或有用信息,我们建议您查看 4images Gallery 官方网站.