Как установить Akaunting с Apache и Lets Encrypt SSL в Ubuntu 22.04
Это руководство существует для этих версий ОС
- Ubuntu 22.04 (Jammy Jellyfish)
- Ubuntu 18.04 (Bionic Beaver)
На этой странице
- Предпосылки
- Установите Apache, MariaDB и PHP.
- Настройка базы данных MariaDB
- Установить Акунтинг
- Настройка Apache для работы с Akaunting
- Безопасный учет с помощью Lets Encrypt SSL
- Доступ к веб-интерфейсу Akaunting
- Заключение
Akaunting — это автономное бухгалтерское приложение с открытым исходным кодом для малого бизнеса и фрилансеров. Он построен с использованием Laravel, Bootstrap, jQuery и RESTful API. Он используется для создания и управления счетами, котировками и финансами через веб-браузер. Он предоставляет пользователям и разработчикам отличный магазин приложений для расширения функциональности Akaunting.
В этом руководстве я покажу вам, как установить учетную программу Akaunting с Apache и Lets Encrypt SSL на Ubuntu 22.04.
Предпосылки
- Сервер под управлением Ubuntu 22.04.
- Действительное доменное имя, указанное с IP-адресом вашего сервера.
- На сервере настроен пароль root.
Установите Apache, MariaDB и PHP
Во-первых, вам нужно будет установить Apache, MariaDB, PHP и другие расширения PHP на свой сервер. Вы можете установить их все, выполнив следующую команду:
apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-imap php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-bcmath php-ldap php-zip php-curl unzip curl -y
После установки всех пакетов отредактируйте файл конфигурации PHP и измените настройки по умолчанию:
nano /etc/php/8.1/apache2/php.ini
Change the following lines:
memory_limit = 256M upload_max_filesize = 16M post_max_size = 16M max_execution_time = 300 date.timezone = UTC
Сохраните и закройте файл, затем перезапустите службу Apache, чтобы применить изменения конфигурации:
systemctl restart apache2
Настроить базу данных MariaDB
Akaunting использует MariaDB/MySQL в качестве базы данных. Итак, вам нужно будет создать базу данных и пользователя для Akaunting.
Сначала войдите в MariaDB с помощью следующей команды:
mysql
После входа в систему создайте базу данных и пользователя для Akaunting с помощью следующей команды:
MariaDB [(none)]> CREATE DATABASE akaunting_db;
MariaDB [(none)]> CREATE USER 'akaunting_user'@'localhost' IDENTIFIED BY 'password';
Затем предоставьте все привилегии базе данных Akaunting с помощью следующей команды:
MariaDB [(none)]> GRANT ALL ON akaunting_db.* TO 'akaunting_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Затем сбросьте привилегии и выйдите из MariaDB с помощью следующей команды:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
Установить Акунтинг
Сначала перейдите на официальную страницу загрузки Akaunting и загрузите последнюю версию, используя следующую команду:
wget -O Akaunting.zip https://akaunting.com/download.php?version=latest
После завершения загрузки разархивируйте загруженный файл в корневой веб-каталог Apache:
mkdir -p /var/www/html/akaunting
unzip Akaunting.zip -d /var/www/html/akaunting
Затем измените владельца и права доступа к каталогу Akaunting:
chown -R www-data:www-data /var/www/html/akaunting/
chmod -R 755 /var/www/html/akaunting/
Как только вы закончите, вы можете перейти к следующему шагу.
Настройте Apache для акаунтинга
Далее вам нужно будет создать файл конфигурации виртуального хоста Apache для Akaunting. Вы можете создать его с помощью следующей команды:
nano /etc/apache2/sites-available/akaunting.conf
Добавьте следующие строки:
<VirtualHost *:80> ServerAdmin DocumentRoot /var/www/html/akaunting ServerName akaunting.example.com DirectoryIndex index.html index.php <Directory /var/www/html/akaunting/> Options +FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/akaunting_error.log CustomLog ${APACHE_LOG_DIR}/akaunting_access.log combined </VirtualHost>
Сохраните и закройте файл, затем активируйте виртуальный хост Apache и перезапишите модуль с помощью следующей команды:
a2ensite akaunting
a2enmod rewrite
Затем перезапустите службу Apache, чтобы применить изменения:
systemctl restart apache2
Теперь вы можете проверить статус Apache с помощью следующей команды:
systemctl status apache2
Вы получите следующий вывод:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2022-11-12 13:45:47 UTC; 10s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 16032 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 16036 (apache2) Tasks: 6 (limit: 464122) Memory: 14.2M CGroup: /system.slice/apache2.service ??16036 /usr/sbin/apache2 -k start ??16037 /usr/sbin/apache2 -k start ??16038 /usr/sbin/apache2 -k start ??16039 /usr/sbin/apache2 -k start ??16040 /usr/sbin/apache2 -k start ??16041 /usr/sbin/apache2 -k start Nov 12 13:45:47 ubuntu22041 systemd[1]: Starting The Apache HTTP Server...
Безопасный учет с помощью Lets Encrypt SSL
Затем рекомендуется защитить свой сайт с помощью Lets Encrypt SSL. Сначала установите клиент Certbot с помощью следующей команды:
apt-get install certbot python3-certbot-apache -y
После установки выполните следующую команду, чтобы защитить свой сайт с помощью Lets Encrypt SSL:
certbot --apache -d akaunting.example.com
Вам будет предложено указать адрес электронной почты и принять условия обслуживания, как показано ниже:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer None 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 Plugins selected: Authenticator apache, Installer apache Obtaining a new certificate Performing the following challenges: http-01 challenge for akaunting.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/akaunting-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/akaunting-le-ssl.conf Enabling available site: /etc/apache2/sites-available/akaunting-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, чтобы установить Lets Encrypt SSL для вашего сайта:
Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-enabled/akaunting.conf to ssl vhost in /etc/apache2/sites-available/akaunting-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://akaunting.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=akaunting.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/akaunting.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/akaunting.example.com/privkey.pem Your cert will expire on 2023-02-12. 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" - 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
Доступ к веб-интерфейсу Akaunting
Теперь откройте веб-браузер и войдите в веб-интерфейс Akaunting, используя URL-адрес http://akaunting.example.com. Вы получите следующий экран:
Выберите свой язык и нажмите кнопку «Далее». Вы получите экран конфигурации базы данных:
Укажите данные вашей базы данных и нажмите кнопку «Далее». Вы получите экран создания учетной записи администратора:
Укажите название вашей компании, адрес электронной почты, пароль и нажмите кнопку «Далее». Вы получите экран входа в Akaunting:
Укажите имя пользователя и пароль администратора и нажмите кнопку «Войти». Вы получите следующий экран:
Нажмите на кнопку Пропустить. Вы получите экран Валюты:
Включите свои валюты и нажмите кнопку «Далее». Вы получите экран плагина:
Установите необходимые модули и нажмите кнопку «Далее». Вы получите следующий экран:
Теперь вы можете создать свой первый счет на приведенном выше экране.
Заключение
Поздравляем! вы успешно установили Akaunting с Apache и Lets Encrypt SSL на сервер Ubuntu 22.04. Теперь вы можете разместить программное обеспечение Akaunting в своей организации, чтобы управлять своими счетами, расценками и финансами из любого места. Не стесняйтесь спрашивать меня, если у вас есть какие-либо вопросы.