Как установить программу ElkArte Forum на Ubuntu 20.04
На этой странице
- Предпосылки
- Установите Apache, PHP и MariaDB
- Настройка базы данных MariaDB
- Скачать ElkArte
- Настройка Apache для ElkArte
- Защитите ElkArte с помощью Lets Encrypt SSL
- Доступ к веб-интерфейсу ElkArte
- Заключение
ElkArte — это бесплатное мощное программное обеспечение для создания форумов с открытым исходным кодом, основанное на Simple Machines Forum. Он написан на PHP и позволяет создать форум сообщества, полностью реагирующий на мобильные и беспроводные устройства. Он разработан, чтобы предоставить все функции, необходимые для полнофункционального форума сообщества, прямо из коробки.
ElkArte — правильный выбор для вас, если вы ищете простую и понятную платформу для форума, которую легко настроить.
В этом руководстве мы покажем вам, как установить ElkArte с Lets Encrypt SSL на Ubuntu 20.04.
Предпосылки
- Сервер под управлением Ubuntu 20.04.
- Действительное доменное имя, указывающее на ваш сервер.
- На вашем сервере настроен пароль root.
Установите Apache, PHP и MariaDB
ElkArte работает на веб-сервере на основе PHP и использует MariaDB в качестве базы данных. Поэтому вам нужно будет установить Apache, MariaDB, PHP и другие расширения PHP на свой сервер. Вы можете установить все пакеты с помощью следующей команды:
apt-get install apache2 mariadb-server php7.4 libapache2-mod-php7.4 php7.4-common php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-mysql php7.4-gd php7.4-pgsql php7.4-xml php7.4-cli php7.4-imagick php7.4-bcmath php7.4-gmp php7.4-zip unzip -y
После установки всех пакетов откройте файл php.ini и настройте некоторые полезные параметры:
nano /etc/php/7.4/apache2/php.ini
Change the following lines: memory_limit = 256M upload_max_filesize = 100M max_execution_time = 360 date.timezone = Asia/Kolkata
Сохраните и закройте файл, затем перезапустите службу Apache, чтобы изменения вступили в силу:
systemctl restart apache2
Настроить базу данных MariaDB
Сначала защитите установку MariaDB и установите корневой пароль MariaDB с помощью следующей команды:
mysql_secure_installation
Ответьте на все вопросы, как показано ниже:
Enter current password for root (enter for none): Set root password? [Y/n] Y New password: Re-enter new password: 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 с помощью следующей команды:
mysql -u root -p
После авторизации создайте базу данных и пользователя для ElkArte:
MariaDB [(none)]> CREATE DATABASE elkdb;
MariaDB [(none)]> CREATE USER 'elk'@'localhost' IDENTIFIED BY 'password';
Затем предоставьте все привилегии elkdb с помощью следующей команды:
MariaDB [(none)]> GRANT ALL ON elkdb.* TO 'elk'@'localhost' WITH GRANT OPTION;
Затем сбросьте привилегии и выйдите из оболочки MariaDB с помощью следующей команды:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
После настройки базы данных можно переходить к следующему шагу.
Скачать ЭлкАрте
Сначала загрузите последнюю версию ElkArte из репозитория Git с помощью следующей команды:
wget https://github.com/elkarte/Elkarte/releases/download/v1.1.6/ElkArte_v1-1-6_install.zip
После завершения загрузки разархивируйте загруженный файл в корневой веб-каталог Apache с помощью следующей команды:
unzip ElkArte_v1-1-6_install.zip -d /var/www/html/elkarte
Затем предоставьте соответствующие разрешения каталогу elkarte с помощью следующей команды:
chown -R www-data:www-data /var/www/html/elkarte/
chmod -R 755 /var/www/html/elkarte/
Как только вы закончите, вы можете перейти к следующему шагу.
Настроить Apache для ЭлкАрте
Затем создайте новый файл конфигурации виртуального хоста Apache для ElkArte.
nano /etc/apache2/sites-available/elkarte.conf
Добавьте следующие строки:
<VirtualHost *:80> ServerAdmin ServerName elk.linuxbuz.com DocumentRoot /var/www/html/elkarte <Directory /var/www/html/elkarte/> Options FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Сохраните и закройте файл, когда закончите. Затем включите виртуальный хост Apache и перепишите модуль с помощью следующей команды:
a2ensite elkarte.conf
a2enmod rewrite
Наконец, перезапустите службу Apache, чтобы изменения вступили в силу.
systemctl restart apache2
Защитите ElkArte с помощью Lets Encrypt SSL
Сначала установите клиент Certbot Lets Encrypt для управления SSL для вашего веб-сайта:
apt-get install certbot python3-certbot-apache -y
После установки Certbot выполните следующую команду, чтобы загрузить и установить Lets Encrypt SSL для своего веб-сайта:
certbot --apache -d elk.linuxbuz.com
Вам будет предложено указать свой адрес электронной почты и принять условия обслуживания, как показано ниже:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator apache, Installer apache Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Obtaining a new certificate Performing the following challenges: http-01 challenge for elk.linuxbuz.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/elk-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/elk-le-ssl.conf Enabling available site: /etc/apache2/sites-available/elk-le-ssl.conf
Затем выберите, следует ли перенаправлять HTTP-трафик на HTTPS, как показано ниже:
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): 2
Введите 2 и нажмите Enter, чтобы завершить установку, как показано ниже.
Redirecting vhost in /etc/apache2/sites-enabled/elk.conf to ssl vhost in /etc/apache2/sites-available/elk-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://elk.linuxbuz.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=elk.linuxbuz.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/elk.linuxbuz.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/elk.linuxbuz.com/privkey.pem Your cert will expire on 2020-08-19. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le - We were unable to subscribe you the EFF mailing list because your e-mail address appears to be invalid. You can try again later by visiting https://act.eff.org.
На данный момент ваш ElkArte защищен с помощью Lets Encrypt SSL.
Доступ к веб-интерфейсу ElkArte
Теперь откройте веб-браузер и введите URL-адрес https://elk.linuxbuz.com. Вы будете перенаправлены на страницу приветствия ElkArte:
Нажмите кнопку «Продолжить». Вы должны увидеть страницу настроек сервера базы данных:
Укажите данные вашей базы данных и нажмите кнопку «Продолжить». Вы должны увидеть страницу настроек форума:
Укажите URL-адрес своего форума, название форума и нажмите кнопку «Продолжить». Вы должны увидеть следующую страницу:
Нажмите кнопку «Продолжить». Вы должны увидеть страницу создания учетной записи администратора:
Введите имя пользователя администратора, пароль, адрес электронной почты и нажмите кнопку «Продолжить». После завершения установки вы должны увидеть следующую страницу:
Нажмите на только что установленный форум. Вы должны увидеть панель инструментов ElkArte на следующей странице:
Заключение
Поздравляем! вы успешно установили ElkArte с Apache и Lets Encrypt SSL на Ubuntu 20.04. Теперь вы можете легко разместить свой собственный форум сообщества с помощью ElkArte. Не стесняйтесь спрашивать меня, если у вас есть какие-либо вопросы.