Beruflich Dokumente
Kultur Dokumente
- After that we will install Apache 2 with this command: sudo apt-get install apache2
- Edit the main Apache configuration file, apache2.conf, to adjust the KeepAlive setting: file:
/etc/apache2/apache2.conf
KeepAlive Off
- The default multi-processing module (MPM) for Apache is the event module but by default PHP uses
the prefork module.
Open the mpm_prefork.conf file located in /etc/apache2/mods-available and edit the configuration.
Below are the suggested values for a 2GB Linode: file: /etc/apache2/mods-
available/mpm_prefork.conf
<IfModule mpm_prefork_module>
StartServers 4
MinSpareServers 20
MaxSpareServers 40
MaxRequestWorkers 200
MaxConnectionsPerChild 4500
</IfModule>
- Restart Apache:
sudo systemctl restart apache2
- Edit the new marumagento.dev.conf configuration file by uncommenting ServerName and replacing
example.com with your sites IP or Fully Qualified Domain Name (FQDN).
Enter the document root path and log directories as shown below, and add a Directory block before
</VirtualHost>: File /etc/apache2/sites-available/marumagento.dev.conf
<Directory /var/www/html/marumagento.dev/public_html>
Order allow,deny
</Directory>
<VirtualHost *:80>
ServerName example.com
ServerAlias www.marumagento.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/marumagento.dev/public_html
ErrorLog /var/www/html/marumagento.dev/logs/error.log
</VirtualHost>
- Link your virtual host file from the sites-available directory to the sites-enabled directory:
sudo a2ensite marumagento.com.conf
- Reload Apache:
sudo systemctl reload apache2
3. Install MySQL
- Install the mysql-server package and choose a secure password when prompted:
sudo apt-get install mysql-server
Log into MySQL: mysql -u root -p . Enter MySQL's root password, and you'll be presented with a
MySQL prompt.
If no password was entered in the previous section, or if you want to change the root password, enter
the following command.
Create a database and a user with permissions for it. In this example, the database is called
marumagento, the user webuser, and password password:
CREATE DATABASE marumagento;
error_log = /var/log/php/error.log
- Create the log directory for PHP and give ownership to the Apache system user:
sudo mkdir /var/log/php
sudo chown www-data /var/log/php
- Restart Apache:
sudo systemctl restart apache2
Install Magento 2
1. Install composer
- At first, we need to download composer, we will run these command:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
This downloads Magento code only; it doesnt install the software for you.
In this case, we will set ownership and permissions for two users
Step 1: Create the Magento file system owner and give the user a strong password
To create a user on CentOS or Ubuntu, enter the following command as a user with root privileges:
adduser <username>
To give the user a password, enter the following command as a user with root privileges:
passwd <username>
Ubuntu: ps aux | grep apache to find the apache user, then groups <apache user> to find the
group
Typically, the user name and the group name are both www-data
Step 3: Put the Magento file system owner in the web servers group
To put the Magento file system owner in the web servers primary group (assuming the typical Apache
group name for CentOS and Ubuntu), enter the following command as a user with root privileges:
For example, to add the user magento_user to the apache primary group on CentOS:
To confirm your Magento user is a member of the web server group, enter the following command:
magento_user : apache
To set ownership and permissions before you install the Magento software:
Log in to your Magento server as, or switch to, the Magento file system owner.
find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
To optionally enter all commands on one line, enter the following assuming Magento is installed in
/var/www/html/magento2 and the web server group name is apache:
In the event file system permissions are set improperly and cant be changed by the Magento file system
owner, you can enter the command as a user with root privileges:
After youve performed the other tasks in this topic, enter one of the following commands to switch
to that user:
Ubuntu: su <username>
CentOS: su - <username>
For example,
su magento_user
The following example shows how to install using the command line with the following options:
The Magento software is installed in the /var/www/html/magento2 directory, which means your
storefront URL is http://192.0.2.5/magento2/
The database server is on the same host as the web server.
The database name is magento, and the user name and password are both magento