X-Cart:Installing X-Cart Manually

From X-Cart 4 Classic
Jump to: navigation, search

Procedure

It is assumed that you are installing X-Cart on a UNIX-based server with terminal access and have adequate skills in using the basic UNIX commands.

To install X-Cart manually:

1. Download the distribution package from the File Area section of your X-Cart Account. The package is archived in the file x-cart-x.y.z.tgz, where x, y and x indicate the version of X-Cart.

2. Use an FTP client to upload the distribution package to a web-accessible directory on your server or hosting account.

Make sure you have set the 'Binary' transfer mode in your FTP client before uploading the X-Cart files to the server . Some of the uploaded files may be damaged if transferred in the 'ASCII'/'Text' mode.

3. Decompress the package by typing one of the following commands:

gunzip < x-cart-X.Y.Z.tgz | tar -xvf -

or

tar -xzvf x-cart-X.X.Z.tgz

That should create the directory /xcart that would contain all the X-Cart files and folders. The /xcart directory is created automatically. If necessary, you can rename it or move its content to a different location; e.g., your document root. In this manual, we are going to refer to the directory with the X-Cart files and folders as X-Cart root directory, X-Cart installation directory or /xcart directory.

4. Change the active directory to the X-Cart root directory.

> cd xcart

5. Set up a MySQL database, which you are going to use with your X-Cart.

The shell commands listed below use the following abbreviations:

<username> : your MySQL account username
<password> : your MySQL account password
<db_host>  : your MySQL server host name or IP-address
<db_name>  : your MySQL database name
a. Clear all the data that could exist in the database, then create the required tables and populate them with the new data. You can do that by typing the following shell commands.
> mysql -u<username> -p<password> -h<db_host> <db_name> < sql/dbclear.sql

> mysql -u<username> -p<password> -h<db_host> <db_name> < sql/xcart_tables.sql

> mysql -u<username> -p<password> -h<db_host> <db_name> < sql/xcart_data.sql

> mysql -u<username> -p<password> -h<db_host> <db_name> < sql/xcart_language_US.sql
b. If you want to test-drive the newly created online store and import a sample product catalog with the demo data, similar to what you could have tried with the online demo available at the product website www.x-cart.com, run the following shell command:
> mysql -u<username> -p<password> -h<db_host> <db_name> < sql/xcart_demo.sql
Later on, you will be able to remove the demo data using the Remove data tool (See the section Advanced Tools for more info).
c. If your company is based in a country with states or, if you are planning to sell internationally, and your customers are going to be from the countries that have states, you may want to import the names of the states for each of those countries. Later on, you will be able use the imported state names for setting up destination zones, your company address and customer addresses.
To import state names, run the following shell command:
> mysql -u<username> -p<password> -h<db_host> <db_name> < sql/states_<country>.sql
replacing the <country> part with one of the following values:
AT for Austria
AU for Australia
BE for Belgium
CA for Canada
DE for Germany
ES for Spain
FR for France
IT for Italy
LU for Luxemburg
NL for the Netherlands
UK for the United Kingdom
US for the United States.
If a particular country is not on the list, you can later add that country and its states to the list manually. The instructions doing so are available in the States section.
d. For some countries, X-Cart allows defining pre-configured store settings, including generic tax rules and rates, destination zones, default company and customer addresses and phone numbers, language variables, which may differ from one country to another (e.g. postal code instead of zip code), etc.

By default, the store installs with the pre-configured settings for the United States. If your store is based in a country other than the United States, you may find it useful to import some pre-configured settings and thus speed up the process of configuring your store.

Currently, such settings are available for: Australia, Canada and the United Kingdom (Great Britain). To import the settings for any of these countries, run the following shell command:

> mysql -u<username> -p<password> -h<db_host> <db_name> < sql/xcart_conf_<country>.sql

replacing the <country> part with one of the following values:

AU for Australia
CA for Canada
UK for United Kingdom.

6. Create the required directories and set proper permissions.

a. Set the 777 permissions for the directories /files, /catalog and /var:
> chmod 777 files catalog var
b. If you are planning to use PGP encryption, create the directory .pgp and set its permissions to 755:
> mkdir .pgp

> chmod 755 .pgp
c. Set the 755 permissions for the script admin/newsletter.sh (the this script is used by the News Management module for sending newsletters):
> chmod 755 admin/newsletter.sh
d. Set the 755 permissions for all the payment modules (files with the *.pl extension inside the payment/ directory):
> chmod 755 payment/*.pl
IMPORTANT! If you upload the X-Cart files to your server via FTP, the ftp user becomes the owner of all the uploaded files and folders. Consequently, the PHP parser on your server is installed as an Apache module, those files and folders appear to be non-writeable for the web user. In this case, you should set writeable file permissions manually, as shown in the example below.

Example of setting write permissions to files and folders:

cd <xcart_dir>
find ./skin -type d -exec chmod 777 {} \;
find ./skin -type f -exec chmod 666 {} \;

8. Open X-Cart's main configuration file config.php for editing and set the true values for the following variables:

$sql_host =’%SQL_HOST%’;

$sql_user =’%SQL_USER%’;

$sql_db =’%SQL_DB%’;

$sql_password =’%SQL_PASSWORD%’;

and

$xcart_http_host =”$HTTP_HOST”;

$xcart_https_host =”$HTTP_HOST”;

$xcart_web_dir =”/xcart”;

9. Set up the skin.

To select a skin for your store:

1. Login to your Admin area using the default user name and password.
Note: The default login and password for X-Cart GOLD and GOLD PLUS editions are, respectively, demo-master@x-cart.com / master, for X-Cart PLATINUM and PRO editions - demo-admin@x-cart.com / admin.
2. Select Settings -> General settings on the menu and then click on the Appearance link on the Core options pane at the right.
3. On the Appearance page, select the skin to be used on the corresponding select box and then click the Apply changes button.
IMPORTANT! To improve the security of your store, make sure to replace the default user name and password with something more secure!

Blowfish key

To ensure the safety of sensitive data in the database (user info, order details, etc.), X-Cart uses the Blowfish encryption algorithm. Encryption is performed using a special key code. In X-Cart, this code is referred to as Blowfish key. The same code is used to decrypt the data when you or your authorized personnel is trying to access the encrypted data (e.g. when viewing an order in the Admin area).

X-Cart keeps the Blowfish in the main configuration file config.php in the variable $blowfish_key. Before the store is installed, the $blowfish_key variable contains a default value. When you install X-Cart using the Installation Wizard, the installation script install.php generates a new Blowfish key and writes it to the $blowfish_key variable in the config.php file. With manual installation, a new Blowfish key is never generated. And when the installation is complete, the $blowfish_key variable still contains the default value. Using the default Blowfish key is not secure, because its value is known to many people. And you need to generate a new value for the Blowfish key.

To generate a new Blowfish key, use the Re-generate the Blowfish encryption key tool. For details on how to carry out this task see section X-Cart:Advanced Tools.

If the newly installed store is supposed to use a database that was previously used use by another X-Cart installation, the data in such database is already encrypted by the Blowfish key generated by that store. It means that neither your nor any of your customers will be able even to log in to their accounts, because the value of the variable $blowfish_key is different to the value of the key which was used to encrypt the store database. To resolve this issue, you need to open the main configuration file config.php for editing and change the value of the variable $blowfish_key to the value of the Blowfish key that was used by the previous X-Cart installation.

See also