Ubuntu'da LeaderOS Nasıl Kurulur
LeaderOS’in Ubuntu sunucusunda kurulum, yapılandırma ve çalıştırma için tam rehber.
Kurulum işlemine başlamadan önce, alan adınızın isim sunucularının/DNS yapılandırıldığından emin olun. Aksi takdirde web sitesine erişemezsiniz.
Alan adınızın isim sunucularını/DNS yapılandırmayı buradan öğrenin.
Otomatik Kurulum
Kurulum scriptini indirin
wget https://installer.leaderos.com.tr/leaderos_installer.sh
Scripti çalıştırılabilir hale getirin.
chmod +x leaderos_installer.sh
Scripti çalıştırın.
./leaderos_installer.sh
Manuel Kurulum
Install Nginx package
sudo apt install nginx -y
Ensure that nginx is running with the systemctl start
command:
sudo systemctl start nginx
80 ve 443 güvenlik duvarı bağlantı noktalarını etkinleştirdiğinizden emin olun.
Setting Up Nginx Server Blocks
When using the Nginx web server, server blocks (similar to virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain from a single server. We will set up a domain called your_domain.com, but you should replace this with your own domain name.
Create directory for your your_domain.com
sudo mkdir -p /var/www/your_domain.com/html
Next, assign ownership of the directory with the www-data.
sudo chown -R www-data:www-data /var/www/your_domain.com/html
Configuring Nginx
In order for Nginx to serve this content, it’s necessary to create a server block with the correct directives. Instead of modifying the default configuration file directly, let’s make a new one at /etc/nginx/sites-available/your_domain.com
:
sudo nano /etc/nginx/sites-available/your_domain.com
Paste in the following configuration block, which is similar to the default, but updated for our new directory and domain name:
server {
listen 80;
listen [::]:80;
root /var/www/your_domain.com/html;
index /apps/main/public/index.php;
server_name your_domain.com www.your_domain.com;
client_max_body_size 128M;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location = /favicon.ico {
rewrite ^ /apps/main/public/favicon.png last;
}
location ~* \.(ini|log|sh|sql|htaccess)$ {
deny all;
}
location ~ "(^|/)apps/(dashboard|api|install)(?!/public)(/?)" {
return 403;
}
location ~ "(^|/)apps/main(?!/public|/app/views/themes/[0-9a-zA-Z-_]+/assets)(/?)" {
return 403;
}
# Installer Assets
location ~ "install/assets/(.*)$" {
try_files $uri $uri/ /apps/install/public/assets/$1;
}
# Dashboard Assets (cached)
location ~* ^/dashboard/assets/(.+)\.(\d+)\.(js|css|png|jpg|gif|ico|ttf|eot|svg|woff|woff2)$ {
try_files /apps/dashboard/public/assets/$1.$3 =404;
}
# Dashboard Assets direct access
location ~ ^/dashboard/assets/(.+)\.(js|css|png|jpg|gif|ico|mp3|mp4|json|ttf|eot|svg|woff|woff2)$ {
try_files $uri /apps/dashboard/public/assets/$1.$2;
}
# Images for Main
location ~ "assets/core/images/(.*)$" {
try_files $uri $uri/ /apps/main/public/images/$1;
}
# Theme Assets (cached)
location ~* ^/assets/([0-9a-zA-Z-_]+)/(.+)\.(\d+)\.(js|css|png|jpg|gif|ico|mp3|mp4|json|ttf|eot|svg|woff|woff2)$ {
try_files /apps/main/app/views/themes/$1/assets/$2.$4 =404;
}
# Theme Assets direct access
location ~ ^/assets/([0-9a-zA-Z-_]+)/(.+)\.(js|css|png|jpg|gif|ico|mp3|mp4|json|ttf|eot|svg|woff|woff2)$ {
try_files /apps/main/app/views/themes/$1/assets/$2.$3 =404;
}
location /install {
try_files $uri $uri/ /apps/install/public/index.php?$query_string;
}
location /api {
try_files $uri $uri/ /apps/api/public/index.php?$query_string;
}
location /dashboard {
try_files $uri $uri/ /apps/dashboard/public/index.php?$query_string;
}
location / {
try_files $uri $uri/ /apps/main/public/index.php?$query_string;
}
}
Next, let’s enable the file by creating a link from it to the sites-enabled directory, which Nginx reads from during startup:
Finally, restart nginx for the configuration to take effect.
sudo systemctl restart nginx
Installing PHP 7.4
Ubuntu
Thereafter, install some important packages to fulfill the post.
sudo apt install software-properties-common -y
The next step is to add the ondrej PPA repository.
sudo add-apt-repository ppa:ondrej/php -y
Refresh APT to load the new repository:
sudo apt update -y
And now you can install PHP 7.4
sudo apt install php7.4 php7.4-fpm -y
E: Package ‘php7.4’ has no installation candidate
If you get this error while installing PHP 7.4. Run this command:
Ubuntu 23.10:
sudo sed -i 's/mantic/jammy/' /etc/apt/sources.list.d/ondrej-ubuntu-*.sources
Ubuntu 23.04:
sudo sed -i 's/lunar/jammy/' /etc/apt/sources.list.d/ondrej-ubuntu-*.list
Then refresh APT:
sudo apt update -y
Now, you can install php 7.4:
sudo apt install php7.4 -y
Install required php extensions.
sudo apt install php7.4-{cli,common,curl,zip,mysql,mbstring,json} -y
Start and enable the php7.4-fpm service.
sudo systemctl start php7.4-fpm
sudo systemctl enable php7.4-fpm
Debian
Thereafter, install some important packages to fulfill the post.
sudo apt-get install ca-certificates apt-transport-https software-properties-common curl lsb-release -y
Import and install the GPG key and repository using an automated script.
curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x
Refresh APT to load the new repository:
sudo apt update -y
And now you can install PHP 7.4
sudo apt install php7.4 php7.4-fpm -y
Install required php extensions.
sudo apt install php7.4-{cli,common,curl,zip,mysql,mbstring,json} -y
Start and enable the php7.4-fpm service.
sudo systemctl start php7.4-fpm
sudo systemctl enable php7.4-fpm
Configure PHP Settings
In order for the LeaderOS software to work, some php settings need to be configured. Open the php.ini file with nano or your preferred text editor.
sudo nano /etc/php/7.4/fpm/php.ini
Add these lines at the end.
allow_url_fopen=On
short_open_tag=On
upload_max_filesize=128M
post_max_size=128M
max_input_vars=10000
memory_limit=512M
max_execution_time=600
max_input_time=600
Then save and exit the file. Now we need to restart the nginx and php-fpm for the settings to come into effect.
sudo systemctl restart nginx
sudo systemctl restart php7.4-fpm
Installing Ioncube Loader
Download IonCube Loader files.
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
Then uncompress the downloaded file using the tar command.
tar -zxvf ioncube_loaders_lin_x86*
Switch into the unzipped folder.
cd ioncube/
Next, find the location of the extension directory for PHP version 7.4, it is where the ioncube loader file will be installed.
php -i | grep extension_dir
Output: extension_dir => /usr/lib/php/20190902 => /usr/lib/php/20190902
Next we need to copy ioncube loader for our PHP 7.4 version to the extension directory (/usr/lib/php/20190902).
sudo cp ioncube_loader_lin_7.4.so /usr/lib/php/20190902
Now we need to configure ioncube loader to work with PHP, in the php.ini file.
sudo nano /etc/php/7.4/fpm/php.ini
Then add below line as the first line in the respective php.ini file.
zend_extension = /usr/lib/php/20190902/ioncube_loader_lin_7.4.so
Then save and exit the file. Now we need to restart the nginx and php-fpm for the ioncube loaders to come into effect.
sudo systemctl restart nginx
sudo systemctl restart php7.4-fpm
Installing MariaDB (MySQL)
Install the mariadb package.
sudo apt install mariadb-server -y
Ensure that MariaDB is running with the systemctl start command:
sudo systemctl start mariadb.service
Additionally, consider enabling MariaDB to start every time on system startup as shown.
sudo systemctl enable mariadb.service
Open up the MariaDB prompt from your terminal:
sudo mariadb
Next, create a regular user. Here, we are creating a user called leaderos. Be sure to replace secret_password with your preferred user’s password.
CREATE USER 'leaderos_user'@'localhost' IDENTIFIED BY 'secret_password';
Next, create a database:
CREATE DATABASE leaderos_db;
Next, grant all privileges to leaderos user. This effectively assigns all the database root user’s permissions to the user.
GRANT ALL PRIVILEGES ON leaderos_db.* TO 'leaderos_user'@'localhost' WITH GRANT OPTION;
To apply the changes, flush the privileges.
FLUSH PRIVILEGES;
Finally, exit the MariaDB prompt.
exit
Configuring MariaDB (MySQL)
Open the MariaDB configration file.
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Add these lines under [mysqld] section.
sql_mode="ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Then save and exit the file. Now we need to restart the MariaDB for the settings to come into effect.
sudo systemctl restart mariadb.service
Installing LeaderOS
Upload the leaderos.zip file to /var/www/your_domain.com/html via FTP and unzip the leaderos.zip file.
Visit your website. You will see the installation page.
sudo chown -R www-data:www-data /var/www/your_domain.com/html