Installing Sugar
Previously we learned what needs to be installed in our development environment, and we got everything set up, we now need to install the Sugar code. There are 3 installation options.
Installing via Setup Wizard
Use the Command Line Installer
Restore a backup
We will need to download Sugar before we get started. There are few places where it can be downloaded
Production Sofware can be downloaded from the Download Manager
Developer Builds can be downloaded from SugarClub
You can also download pre-release versions from Sugar Release Previews
If you are on Sugar Cloud and you would like to restore from backup. Log in to Sugar, head on over to Admin. In the Sugar Cloud section, you will find an option Download Backups. Please note: if you find that your backups are either outdated or empty, file a support request with Sugar Support.
Now that we have an installable will need to collect the required information for each installer.
Download Key - This is your Sugar License
Database
Database Name: Name of the database to be created and used with this installation of Sugar. If the database name entered is an existing database on the specified server, the existing database and its contents will be deleted and replaced with the Sugar database.
Host Name: Name of the server or machine where the database will be created and used with this installation of Sugar.
Database Administrator Username: Provide the user name of an administrative user who has proper permissions to create databases and tables on the specified database server.
Database Admin Password: Provide the password of the specified administrative user.
Search Engine: The Elasticsearch server is required to install Sugar and is selected by default.
Host: Enter the hostname or IP address of the full-text search engine. Defaults to "localhost" assuming you are running the search engine on the same server as Sugar.
Port: Enter the port number for communicating with the full-text search engine. Defaults to "9200", which is Elasticsearch's default.Username and Password of an account with permission to create a database
Optionally; we can create a sugar-specific user during the installation process; if you would like to use this option, the user username specified above will need permission to create a new user. This is ideal for production but not necessary for development.
Now that we have the information; we can proceed with the installation.
Installing via Setup Wizard
Step By Step instruction is provided on the Install via the Setup Wizard page.
Command Line Installation
Buried in the documentation is a page on how to install via the command line. For this method of installation, you create a file config_si.php which uses configuration variables to answer all of the questions that were part of the Setup Wizard.
<?php
$sugar_config_si = array (
'setup_site_url' => 'http://${domainname}:${webport}/sugar',
'setup_system_name' => '${systemname}',
'setup_db_host_name' => 'localhost',
'setup_site_admin_user_name' => 'admin',
'setup_site_admin_password' => '${sugarpassword}',
'demoData' => true,
'setup_db_type' => 'mysql',
'setup_db_host_name' => '{db_host_name}',
'setup_db_port_num' => 'db_port_number',
'setup_db_database_name' => 'sugar',
'setup_db_admin_user_name' => 'root',
'setup_db_admin_password' => '${rootpassword}',
'setup_db_options' => array(
'ssl' => true,
),
'setup_db_drop_tables' => false,
'setup_db_create_database' => true,
'setup_license_key' => '${slkey}',
'setup_license_key_users' => '${slkeyusers}',
'setup_license_key_expire_date' => '${slkeyexpiredate}',
'setup_license_key_oc_licences' => '${slkey_oc_licenses}',
'default_currency_iso4217' => 'USD',
'default_currency_name' => 'US Dollars',
'default_currency_significant_digits' => '2',
'default_currency_symbol' => '$',
'default_date_format' => 'Y-m-d',
'default_time_format' => 'H:i',
'default_decimal_seperator' => '.',
'default_export_charset' => 'ISO-8859-1',
'default_language' => 'en_us',
'default_locale_name_format' => 's f l',
'default_number_grouping_seperator' => ',',
'export_delimiter' => ',',
);
Once the config_si.php is placed into the root directory of Sugar, you can then launch the installation by going to your URL with a few extra parameters
http://${hostname}/sugar/install.php?goto=SilentInstall&cli=true
Restore a Backup
From within Sugar Cloud, Go to Admin and then select the Download Backups option. You will be presented with a screen similar to:
Press the Download Backup button.
Depending upon the size of your backup it may take some time to download. The file that is downloaded will be a Tape Archive Gzipped file with the extension .tar.gz. Use the command to extract the files.
tar xzf filename.tar.gz
Once extracted you will have a directory that contains all of the Sugar files along with a mysqldump of the database.
The directory will look similar to:
sugar1130ent
sugar1130ent.sql
sugar1130ent_triggers.sql
You will need to restore, sugar1130ent.sql, to your MySQL. The file sugar1130ent_triggers.sql holds any triggers that may be used. In 99.9999% of cases, there will not be any triggers and you can ignore this file.
Sugar is in the sugar1130ent directory. This indicates this is Sugar 11.3.0. Move this folder to your web server’s folder. You’ll need to edit the files config.php and .htaccess.
Within config.php update, the code blocks to point to your MySQL and Elasticsearch
'dbconfig' =>
array (
'db_host_instance' => 'SQLEXPRESS',
'db_type' => 'mysql',
'db_manager' => 'MysqliManager',
'db_host_name' => '',
'db_user_name' => '',
'db_password' => '',
'db_name' => '',
),
'full_text_engine' =>
array (
'Elastic' =>
array (
),
),
You will also need to update or create a .htaccess file. Update the line
RewriteBase /
to point to your instance. In my case, it would read
RewriteBase /sugar1130ent/
If the .htaccess file is missing, you can use this one
# BEGIN SUGARCRM RESTRICTIONS
# Fix mimetype for logo.svg (SP-1395)
AddType image/svg+xml .svg
AddType application/json .json
AddType application/javascript .js
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule (?i)package\.json - [F]
RewriteRule (?i)yarn\.lock - [F]
RewriteRule (?i)gulpfile\.js - [F]
RewriteRule (?i)webpack\.config\.js - [F]
RewriteRule (?i)\.git - [F]
RewriteRule (?i)\.log$ - [F]
RewriteRule (?i)^bin/ - [F]
RewriteRule (?i)^cache/diagnostic/ - [F]
RewriteRule (?i)^composer\.(json|lock)$ - [F]
RewriteRule (?i)^cron\.php$ - [F]
RewriteRule (?i)^custom/blowfish/ - [F]
RewriteRule (?i)^dist/ - [F]
RewriteRule (?i)^emailmandelivery\.php$ - [F]
RewriteRule (?i)^files\.md5$ - [F]
RewriteRule (?i)^src/ - [F]
RewriteRule (?i)^upload/ - [F]
RewriteRule (?i)^upgrades/ - [F]
RewriteRule (?i)^vendor/(?!ytree.*\.(css|gif|js|png)$) - [F]
RewriteRule (?i)^(cache|clients|data|examples|include|install|jssource|metadata|ModuleInstall|modules|soap|xtemplate)/.*\.(php|tpl)$ - [F]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^rest/(.*)$ api/rest.php?__sugar_url=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^cache/api/metadata/lang_(.._..)_(.*)_public(_ordered)?\.json$ rest/v10/lang/public/$1?platform=$2&ordered=$3 [N,QSA,DPI]
RewriteRule ^cache/api/metadata/lang_(.._..)_([^_]*)(_ordered)?\.json$ rest/v10/lang/$1?platform=$2&ordered=$3 [N,QSA,DPI]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^cache/Expressions/functions_cache(_debug)?.js$ rest/v10/ExpressionEngine/functions?debug=$1 [N,QSA,DPI]
RewriteRule ^cache/jsLanguage/(.._..).js$ index.php?entryPoint=jslang&module=app_strings&lang=$1 [L,QSA,DPI]
RewriteRule ^cache/jsLanguage/(\w*)/(.._..).js$ index.php?entryPoint=jslang&module=$1&lang=$2 [L,QSA,DPI]
RewriteRule ^oauth-handler/(.*)$ index.php?module=EAPM&action=$1 [L,QSA]
RewriteRule ^portal/(.*)$ portal2/$1 [L,QSA]
RewriteRule ^portal$ portal/? [R=301,L]
</IfModule>
<IfModule mod_mime.c>
AddType application/x-font-woff .woff
</IfModule>
<FilesMatch "\.(jpg|png|gif|js|css|ico|woff|svg)$">
<IfModule mod_headers.c>
Header set ETag ""
Header set Cache-Control "max-age=2592000"
Header set Expires "01 Jan 2112 00:00:00 GMT"
</IfModule>
</FilesMatch>
<IfModule mod_expires.c>
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg "access plus 1 month"
</IfModule>
<IfModule mod_headers.c>
Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>
# END SUGARCRM RESTRICTIONS