xywuyiba7 发表于 2019-2-19 08:57:31

How to Install OroCRM with Nginx on Ubuntu16.04LTS-Arnold

  OroCRM is an open source Customer>  In this tutorial, we will learn how to install OroCRM on Ubuntu 16.04.
Prerequisites

[*]  A server running Ubuntu 16.04.
[*]  A non-root user with sudo privileges.
Getting Started
  First, you will need to update your system to the latest version. You can do this with the following command:
  sudo apt-get update -y
  sudo apt-get upgrade -y
  Once your system is updated, restart your system to apply all the changes. Next, install required packages to your system with the following command:
  sudo apt-get install git curl unzip wget -y
Install LEMP Server
  Before starting, you will need to install LEMP (Nginx, MariaDB and PHP7) to your system.
  First, install Nginx using the following command:
  sudo apt-get install nginx -y
  Once Nginx is installed, start Nginx service and enable it to start on boot time with the following command:
  sudo systemctl start nginx
  sudo systemctl enable nginx
  By default, the latest version of the MariaDB and PHP is not available in Ubuntu 16.04. So you will need to add the repository for that.
  First, add the MariaDB repository with the following command:
  sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
  sudo add-apt-repository 'deb http://kartolo.sby.datautama.net.id/mariadb/repo/10.2/ubuntu xenial main'
  Next, add PHP repository with the following command:
  sudo add-apt-repository ppa:ondrej/php
  Next, update the repository with the following command:
  sudo apt-get update -y
  Once the repository is updated, install MariaDB and PHP7 by running the following command:
  sudo apt-get install mariadb-server php7.0 php7.0-fpm php7.0-common php7.0-curl php7.0-gd php7.0-intl php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-xml php7.0-xml php7.0-zip php7.0-tidy php7.0-soap php7.0-opcache -y
  Next, you will need to set Timezone and increase memory limit in php.ini file:
  sudo nano /etc/php/7.0/cli/php.ini
  Change the following line:
date.timezone = Asia/Kolkata  Save and close the file, when you are finished.
  sudo nano /etc/php/7.0/fpm/php.ini
  Change the following line:
memory_limit = 1024M  Save and close the file, when you are finished.
  Next, start MariaDB and PHP-FPM service and enable them to start on boot with the following command:
  sudo systemctl start mysql
  sudo systemctl enable mysql
  sudo systemctl start php7.0-fpm
  sudo systemctl enable php7.0-fpm
Confogure MariaDB for OroCRM
  By default MariaDB installation is not secured, so you will need to secure MariaDB first. You can secure it by running mysql_secure_installation script:
  sudo mysql_secure_installation
  Answer all the questions as shown below:
Set root password? Y  
New password:
  
Re-enter new password:
  
Remove anonymous users? Y
  
Disallow root login remotely? Y
  
Remove test database and access to it? Y
  
Reload privilege tables now? Y
  Next, login to MariaDB shell and create a database and user for OroCRM:
  mysql -u root -p
  Enter your root password and press Enter, then create a database and user with the following command:
  MariaDB [(none)]> CREATE DATABASE orodb;

  MariaDB [(none)]> CREATE USER 'orouser'@'localhost'>  Next, grant privileges to the OroCRM database with the following command:
  MariaDB [(none)]> GRANT ALL PRIVILEGES ON orodb.* TO 'orouser'@'localhost';

  Next, run the FLUSH PRIVILEGES command so that the privileges table will be>  MariaDB [(none)]> FLUSH PRIVILEGES;
  Finally, exit from the MariaDB shell:
  MariaDB [(none)]> EXIT
  Once the MariaDB is configured, you can proceed to the next step.
Install Node.js and Composer
  You will also need to install Node.js and Composer to your system. Because Node.js will be used by OroCRM to compile the JavaScript and Composer will be used to install PHP dependencies.
  First, add the Node.js repository using the following command:
  sudo curl --silent --location https://deb.nodesource.com/setup_8.x | sudo bash -
  Next, install Node.js and Composer with the following command:
  sudo apt-get install nodejs -y
  sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  sudo php composer-setup.php
  Next, copy Composer to the /usr/bin directory with the following command:
  sudo cp composer.phar /usr/bin/composer
  Provide necessary permission to the Composer with the following command:
  sudo chmod 755 /usr/bin/composer
Install OroCRM
  First, you will need to download the latest version of the OroCRM from Git repository. You can do this with the following command:
  cd /var/www/html
  sudo git clone -b 2.4 https://github.com/oroinc/crm-application.git orocrm
  Next, change the directory to the orocrm and install dependencies required by PHP using the following command:
  cd orocrm
  sudo composer install --prefer-dist --no-dev
  During the installation you will need to provide database details, like database name, database username and password, database host as follows:
Creating the "app/config/parameters.yml" file  
Some parameters are missing. Please provide them.
  
database_driver (pdo_mysql):
  
database_host (127.0.0.1):
  
database_port (null):
  
database_name (oro_crm): orodb
  
database_user (root): orouser
  
database_password (null): password
  
mailer_transport (smtp):
  
mailer_host (127.0.0.1):
  
mailer_port (null):
  
mailer_encryption (null):
  
mailer_user (null):
  
mailer_password (null):
  
websocket_bind_address (0.0.0.0):
  
websocket_bind_port (8080):
  
websocket_frontend_host ('*'):
  
websocket_frontend_port (8080):
  
websocket_backend_host ('*'):
  
websocket_backend_port (8080):
  
web_backend_prefix (''):
  
session_handler (session.handler.native_file):
  
locale (en):
  
secret (ThisTokenIsNotSoSecretChangeIt):
  
installed (null):
  
assets_version (null):
  
assets_version_strategy (time_hash):
  
message_queue_transport (dbal):
  
message_queue_transport_config (null):
  Next, install the application by running the following command:
  sudo php app/console oro:install --env=prod
  During the installation you will need to provide administrator account details:
Administration setup.  
Application URL (http://localhost):
  
Organization name (OroCRM):
  
Username (admin):
  
Email: hitjethva@gmail.com
  
First name: hitesh
  
Last name: jethva
  
Password:
  
Load sample data (y/n): y
  

  
Oro Application has been successfully installed in prod mode.
  
Please run oro:api:doc:cache:clear command to warm-up API documentation cache
  
Make sure that consumer command was running oro:message-queue:consume. More info you can find here: https://www.orocrm.com/documentation/current/book/installation#activating-background-tasks.
  Next, warm up the API documentation cache using the following command:
  sudo php app/console oro:api:doc:cache:clear
Configure Nginx for OroCRM
  Next, you will need to create an Nginx virtual host file for OroCRM. You can do this with the following command:
  sudo nano /etc/nginx/sites-available/orocrm
  Add the following lines:
server {  
    server_name example.com;
  
    root/var/www/html/orocrm/web;
  

  
    location / {
  
      # try to serve file directly, fallback to app.php
  
      try_files $uri /app.php$is_args$args;
  
    }
  

  
    location ~ ^/(app|app_dev|config|install)\.php(/|$) {
  
      fastcgi_pass unix:/run/php/php7.0-fpm.sock;
  
      fastcgi_split_path_info ^(.+\.php)(/.*)$;
  
      include fastcgi_params;
  
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  
      fastcgi_param HTTPS off;
  
    }
  

  
    # Enable Gzip compression
  
    gzip on;
  
    gzip_buffers 16 8k;
  
    gzip_comp_level 5;
  
    gzip_disable "msie6";
  
    gzip_min_length 1000;
  
    gzip_http_version 1.0;
  
    gzip_proxied any;
  
    gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css image/svg+xml;
  
    gzip_vary on;
  

  
    # Enable browser caching
  
    # One week for javascript and css
  
   location ~* \.(?:css|js) {
  
       expires 1w;
  
       access_log off;
  
       add_header Cache-Control public;
  
   }
  

  
   # Three weeks for media: images, fonts, icons, video, audio etc.
  
   location ~* \.(?:jpg|jpeg|gif|png|ico|tiff|woff|eot|ttf|svg|svgz|mp4|ogg|ogv|webm|swf|flv)$ {
  
       expires 3w;
  
       access_log off;
  
       add_header Cache-Control public;
  
   }
  

  
    error_log /var/log/nginx/orocrm_error.log;
  
    access_log /var/log/nginx/orocrm_access.log;
  
}
  Save and close the file when you are finished, then enable Nginx virtual host with the following command:
  sudo ln -s /etc/nginx/sites-available/orocrm /etc/nginx/sites-enabled/orocrm
  Next, check Nginx for any configuration error with the following command:
  sudo nginx -t
  You should see the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok  
nginx: configuration file /etc/nginx/nginx.conf test is successful
  Next, provide necessary permission to the orocrm directory and restart Nginx:
  sudo chown -R www-data:www-data /var/www/html/orocrm
  sudo chmod -R 777 /var/www/html/orocrm
  sudo systemctl restart nginx
Access OroCRM
  OroCRM is now installed, it's time to access OroCRM web interface.
  Open your web browser and type the URL htttp://example.com, you will be redirected to the OroCRM login page as shown below:

  Provide your admin username and password, then click on the Login button, you should see the OroCRM dashboard in following image:

  Congratulations! OroCRM is now installed on Ubuntu 16.04 server.


页: [1]
查看完整版本: How to Install OroCRM with Nginx on Ubuntu16.04LTS-Arnold