Category Archives: How-to

Manually Install ERPNext on a Manual Install of Frappe

Tags :

Category : How-to

Get Social!

erpnext-screenERPNext is an Enterprise Resource Planning suite similar to Odoo. It manages every aspect of your business from time and expense tracking and payroll to invoicing and manufacturing.

Installing ERPNext is simple enough if you go with their automated approach, but can be a little more tricky when you’re wanting to control where services are. The automated install assumes everything is on the same box however it’s very likely you’ll have your database installed elsewhere.

ERPNext uses a Python framework called Frappe which must be installed before you can use ERPNext. This guide assumes you’ve completed the previous post in this series of manually installing Frappe.

To install ERPNext into your existing Frappe install, change to the frappe user and install the erpnext app.

su - frappe
bench get-app erpnext https://github.com/frappe/erpnext

Login to your SQL server (this can be MySQL or MariaDB) and create a new database for the ERPNext installation.

create database erpnext;

Add a user with all privalages on the database.

GRANT ALL PRIVILEGES ON erpnext.* TO 'root'@'erphost' IDENTIFIED BY 'password' WITH GRANT OPTION;

Replace erphost with your IP address of the server hosting Frappe and ERPNext and password with the password you would like to use for this remote root user.

Run the commands on the Frappe host to create a new site for the ERPNext installation.

bench new-site site1.local --db-name erpnext --mariadb-root-username root --mariadb-root-password password --install-app erpnext --verbose --force

Again, replace password with the password of the root user we just created.

The database tables and core data should now be installed and you’ll be prompted for an administrator username. This will be the initial username that you use to access the front page site.

Create a config for Bench, Nginx and Supervisor and copy them into place:

bench setup procfile
bench setup nginx
bench setup supervisor
cp /home/frappe/frappe-bench/config/nginx.conf /etc/nginx/sites-available/default
cp /home/frappe/frappe-bench/config/supervisor.conf /etc/supervisor/conf.d/supervisor.conf

And that’s it – restart everything and your ERPNext site should be accessible from http://ip-address/

service nginx restart
service supervisor restart

 


Manually Install Frappe on Ubuntu 14.04 With a Remote SQL Server

Get Social!

frappeFrappe is a full stack web framework based on Python and Javascript which can be used to build and deploy web applications. The main focus of this post is to set up a Frappe environment that can be used for ERPNext.

Before starting, install MariaDB 10.x on a remote host (or local, but that’s less common in a production environment) as we’ll use that later.

Create a user for Frappe – here we’ll use frappe but you can change this for anything you like. If you do change the user remember to update the home directory.

useradd -d /home/testuser -m -d /home/frappe frappe

Set the password for the frappe user with passwd.

passwd frappe

Install the required dependencies. Notice that we’ve not included an SQL server as we’ll use a remote MariaDB SQL Server.

apt-get update
apt-get install -y python-dev python-setuptools build-essential python-mysqldb git ntp vim screen htop libmariadbclient-dev  libxslt1.1 libxslt1-dev redis-server libssl-dev libcrypto++-dev postfix supervisor python-pip fontconfig libxrender1 libxext6 xfonts-75dpi xfonts-base cron mysql-client curl nginx

Download and install the latest version of wkhtmltopdf from Sourceforge.

cd /tmp/
wget http://sourceforge.net/projects/wkhtmltopdf/files/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb/download
dpkg -i download
apt-get -f -y install

Download Frappe from Github as the frappe user.

su - frappe
cd /home/frappe
git clone https://github.com/frappe/bench bench-repo
exit

Run the pip installer for Frappe.

pip install -e bench-repo

Create a new Bench as the frappe user.

su - frappe
bench init frappe-bench && cd frappe-bench

Add the default site configuration file with the remote SQL database hostname/ IP and port number.

vi /home/frappe/frappe-bench/sites/common_site_config.json

And add:

{
 "db_host": "database.host.com",
 "db_port": "3306"
}

Before you create any sites, you’ll need to apply a few settings to your SQL server. This guide assumes you have a remote MariaDB SQL Server – log into it and add the below to your my.conf file.

vi /etc/mysql/my.conf
[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

And restart your SQL server for the changes to take affect.

service mysql restart

Copy the Supervisor config file into place so that Frappe automatically starts up with the system.

cp /home/frappe/frappe-bench/config/supervisor.conf /etc/supervisor/conf.d/

 


Enable Compression in Nginx

Category : How-to

Get Social!

nginx-logoEnabling web content compression is one of the simplest ways to save bandwidth and, for some users, speed up the time it takes to serve a page. All modern browsers support content compression and the CPU overhead for clients is a thing of the past.

Compressing content on your server however, can be CPU intensive and something you may have to plan for. Generally, compressing anything is a trade off between size of the content and the CPU cycles required in compressing it. With Nginx, content that has compression enabled has to be sent through a gzip algorithm to compress it before it’s sent to the client.

Some content does not lend itself to compression in this manner. such as images and zip archives. This is because this content has already been compressed and compressing further will have little or no result. In fact, certain types of content can even end up larger after compression. Due to this, we only tend to compress content such as HTML, CSS, JS, XML and other text based content.

The below steps will enable gzip compression for the entire Nginx server – that includes all server{} tags listed in the sites-enabled config.

Create a new file called compression.conf in the Nginx conf.d directory. If this directory doesn’t exist on your Nginx installation, you can add this to the bottom of nginx.conf.

vi /etc/nginx/conf.d/compression.conf

Add the below text and save and close the file.

gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xm
l+rss text/javascript application/javascript text/x-js;
gzip_buffers 16 32k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

I won’t detail each line in the file, but two of the interesting attributes are:

  • gzip_comp_level – this is the compression level that gzip will apply to the content, between 1 and 9 where 1 is the lowest compression and 9 is the highest. Again, this is a trade of between CPU (and therefore time to compress the content) and the resulting file size. 5 – 7 is usually considered a sensible range for this value.
  • gzip_types – this is the MIME type of content that may be compressed. As you can see, each entry here is text based with no images/ zip files listed.

Reload the Nginx config for the changes to take effect.

service nginx reload

 


Zimbra Email Server Intergration with SendGrid

Category : How-to

Get Social!

zimbra-logoZimbra Email Server is an install anywhere, full featured email server solution. I know that sounds like a sales pitch, but it really is one of the better all-in-one on premise email solutions. It’s scalable, deployable on several platforms and hosts a comprehensive web mail service for users to manage email from a browser.

As good as Zimbra is, it can’t (or can any email server) make up for a bad network set up. For example, many email servers, such as Hotmail, will simply bounce emails coming from dynamic IP addresses – bad news if you run Zimbra from home. You’ll also need to set up SPF records to validate email being sent from your server against your domain.

To simplify the sending part of your email server, you can use a service such as SendGrid. What SendGrid do is act as the middle man between your email server and the recipient. Your email server will forward sent emails to SendGrid and SendGrid will deliver the email to the recipient with all the required configuration taken care of to keep your sent email out of the SMAP bin.

Before we get going, we’ll need an account on SendGrid. The free account should be enough to get you started.

To set up Zimbra, we need to configure the MTA to relay all email to our SendGrid address for SendGrid to relay the email to the recipient. Follow the below steps to set up Zimbra as a relay server.

Open the below file in your favourite text editor:

vi /opt/zimbra/conf/relay_password

And add, all on one line, smtp.sendgrid.net along with your username and password in the following format username:password. For example:

smtp.sendgrid.net james:mypa55w0rd

Next, run the following commands in order to configure Zimbra’s MTA to use your above SMTP credentials to relay all outgoing email.

postmap /opt/zimbra/conf/relay_password
postmap -q smtp.sendgrid.net /opt/zimbra/conf/relay_password
zmprov ms `zmhostname` zimbraMtaSmtpSaslPasswordMaps lmdb:/opt/zimbra/conf/relay_password
zmprov ms `zmhostname` zimbraMtaSmtpSaslAuthEnable yes
zmprov ms `zmhostname` zimbraMtaSmtpCnameOverridesServername no
zmprov ms `zmhostname` zimbraMtaSmtpTlsSecurityLevel may
zmprov ms `zmhostname` zimbraMtaSmtpSaslSecurityOptions noanonymous
zmprov ms `zmhostname` zimbraMtaRelayHost smtp.sendgrid.net:587

Zimbra will reload the config after 2 minutes (by default) and your new changes will take affect.

Send a test email and you should see that all new outgoing email is sent via SendGrid.


Install Nginx on Debian/ Ubuntu

Category : How-to

Get Social!

nginx-logoInstalling Nginx on Debian or Ubuntu is as easy as a single apt-get command, however it does not install the latest version of Nginx. In fact, the latest stable Nginx version is 1.8 and the latest package in Debian’s standard repository is 1.2

To get the latest stable version we need to add a new source to our package manager. Before doing so, add the Nginx PGP key which is used to sign all packages. Run the below commands to download the key from Nginx.com, add it to our package manager and clean up the local downloaded file.

wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
rm nginx_signing.key

We can now create the new source file with the Nginx repository location.

vi /etc/apt/sources.list.d/nginx.list

Add one of the following depending on your Linux distribution. You will need to change wheezy or trusty to the codename of your distribution version.

Debian

deb http://nginx.org/packages/debian/ wheezy nginx
deb-src http://nginx.org/packages/debian/ wheezy nginx

Ubuntu

deb http://nginx.org/packages/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/ubuntu/ trusty nginx

 

Finally, update your local repository cache and install Nginx.

apt-get update
apt-get install nginx

Run -v on nginx and you should see something like version 1.8.0.

nginx -v
nginx version: nginx/1.8.0

 


When Did my Linux Box Last Reboot/ Shutdown?

Get Social!

Linux penguinThe Linux command last can tell you when your Linux system last rebooted, shutdown, who logged in and any runlevel changes.

The utility parses the Linux log file  /var/log/wtmp which contains time stamped entries of these important system events.

The last command is usually installed on most Linux distributions by default and is usually ran as the root user.

Running last on it’s own will display system reboots and user logins with information such as dates, usernames and IP addresses.

last
root     pts/0        10.27.2.100      Thu May 28 00:29   still logged in
root     pts/1        10.27.2.100      Thu May 21 19:55 - 12:02 (5+16:06)
root     pts/0        10.27.2.100      Wed May 20 23:01 - 12:02 (6+13:00)
reboot   system boot  3.18.13+         Wed May 20 23:00 - 00:29 (7+01:29)
root     pts/2        10.27.2.100      Wed May 20 22:43 - down   (00:16)
root     pts/1        10.27.2.100      Wed May 20 16:40 - 16:40  (00:00)
root     pts/0        10.27.2.100      Mon May 18 09:07 - down  (2+13:53)

You can see in the above output that the operating system was last rebooted on the 20th of  May.

There are various switches you can apply to the last command to modify the output. The most common is-x to include runlevel changes and shutdown events in the output.

last -x
root     pts/0        10.27.2.100      Thu May 28 00:29   still logged in
root     pts/1        10.27.2.100      Thu May 21 19:55 - 12:02 (5+16:06)
root     pts/0        10.27.2.100      Wed May 20 23:01 - 12:02 (6+13:00)
runlevel (to lvl 2)   3.18.13+         Wed May 20 23:00 - 00:31 (7+01:30)
reboot   system boot  3.18.13+         Wed May 20 23:00 - 00:31 (7+01:30)
shutdown system down  3.18.7+          Wed May 20 23:00 - 23:00  (00:00)
runlevel (to lvl 6)   3.18.7+          Wed May 20 23:00 - 23:00  (00:00)
root     pts/2        10.27.2.100      Wed May 20 22:43 - down   (00:16)
root     pts/1        10.27.2.100      Wed May 20 16:40 - 16:40  (00:00)
root     pts/0        10.27.2.100      Mon May 18 09:07 - down  (2+13:53)

You can also use last to analyse a log file out of position, such as a logfile you’ve archived. Use the -f switch along with the log file path and name to read it’s data.

last -f /mnt/archive/webserver/wtmp
root     pts/0        10.27.2.100      Thu May 28 00:29   still logged in
root     pts/1        10.27.2.100      Thu May 21 19:55 - 12:02 (5+16:06)
root     pts/0        10.27.2.100      Wed May 20 23:01 - 12:02 (6+13:00)
reboot   system boot  3.18.13+         Wed May 20 23:00 - 00:35 (7+01:34)
root     pts/2        10.27.2.100      Wed May 20 22:43 - down   (00:16)
root     pts/1        10.27.2.100      Wed May 20 16:40 - 16:40  (00:00)
root     pts/0        10.27.2.100      Mon May 18 09:07 - down  (2+13:53)

 


Visit our advertisers

Quick Poll

What type of VPN protocol do you use?

Visit our advertisers