| [Installation](/Installation) | [Work with Openbravo](/Installation/Appliance/Openbravo) | [Configuration of appliance](/Installation/Appliance/Config) | [Howto / Optional configuration](/Installation/Appliance/Howto) | [Migration to new appliances](/Installation/Appliance/Migration) |
ℹ️ Catatan: This document refer to appliances 12.04, 14.04 and 18.04.
For EC2 look [here](/#Login_by_ssh_in_EC2).
ssh openbravo@<IP_ADDRESS>
Default password: openbravo
ssh openbravo@<IP_ADDRESS> -i <ec2-key>.pem
ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/<your_user>/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/<your_user>/.ssh/id_rsa.
Your public key has been saved in /home/<your_user>/.ssh/id_rsa.pub.
The key fingerprint is:
xxxxxxxxxxxxxxxxxxxxxxx
The results of this command:
These keys can be the only way to access to your server, so ensure that you save it in a good place and better to have backups of them.
ℹ️ Catatan: The new Appliance 18.04 will no longer accept the deprecated ssh-keys of type DSA (ssh-dss in authorized_keys). If you still have a ssh-key of that type you need to make a new one as written below.
If you don't have a ssh key follow this [guide](/#Create_ssh_key).
ssh-copy-id openbravo@<IP_ADDRESS>
Alternatively it is possible to manually append the contents of your public key (usually .ssh/id_rsa.pub) to the file /home/openbravo/.ssh/authorized_keys of the appliance.
The appliances of EC2 already has ssh only with public key, so no needed to do this steps on it.
IMPORTANT: [Add your public to the instance](/#Add_ssh_keys_to_the_appliance), before enable access by only public key.
ssh -v openbravo@<IP_ADDRESS>
With '-v' it will show that it is using the public key and will ask for the password and will allow to connect.
Check that when doing the previous ssh with debug (-v) show a line with this:
debug1: Authentication succeeded (publickey).
To test the connection with public key, connect with putty and specify:
ℹ️ Catatan: VERY IMPORTANT: [Check that the access with public key](/#Setup_ssh_with_only_public_key) it is working, before remove the ssh with password !! After login by ssh, copy paste this command and run it:
sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
Restart ssh to apply the changes
sudo /etc/init.d/ssh restart
ℹ️ Catatan: Check to make a new connection before close the current connection.
Doing ssh with '-v' it should show a line with:
debug1: Authentications that can continue: publickey
And should not appear password in the options.
The very minimum needed memory to run the appliance is 1.5GB, in order to adjust to this very low memory tomcat is configured with 1GB and postgres with 128MB. This values works for few concurrent users and small/medium databases.
If you plan to go production you probably need to increase this values, but there is not a defined values that works for all, so you need to adjust the memory settings depending of your needs.
ℹ️ Catatan: Before increase the memory, check that you have have enough memory on the system.
ℹ️ Catatan: Remember to not assign all the memory of the system to tomcat and postgres, and leave some ram for the operating system and some more free that will be use for caching that will help to improve the performance.
It is recommended to increase the memory assigned to Tomcat when:
A tip to setup the correct value:
To increase the tomcat memory edit the file /etc/profile.d/tomcat.sh
sudo nano /etc/profile.d/tomcat.sh
Increase the Xmx parameter, for example for set 2048 MB to tomcat, Change:
-Xmx1024M
With
-Xmx2048M
ℹ️ Catatan: If you give to tomcat more memory than the one that the system has free it will show a "can not allocate memory" or "The size of the object heap + VM data exceeds the maximum representable size" error in the log (/var/log/openbravo/catalina.out).
It is recommended to increase the memory of postgres when:
A tips to which value you need for postgres memory could be:
psql -h localhost -U tad openbravo
\l+
\q
To increase postgres memory edit the postgresql.conf file
sudo nano /etc/postgresql/9.1/main/postgresql.conf # Appliance 12.04
sudo nano /etc/postgresql/9.3/main/postgresql.conf # Appliance 14.04
sudo nano /etc/postgresql/10/main/conf.d/91-local-custom.conf # Appliance 18.04
Edit the shared_buffers, for example to set 1GB:
shared_buffers = 1GB
Note: if you want to set one or more gigabytes you can specify in GB instead of MB. GB does not accept decimals so if you are not going to use integer numbers you need to use MB
ℹ️ Catatan: The following about shmmax only applies to old Appliance 12.04 with postgres < 9.3.
Increasing the shmmax parameter of the kernel.
Take into account that there is not only postgres which uses the shm memory, so set this value to a higher value that the one that you have set for postgres.
For example if you set 1GB for postgres you can add 256MB for the rest of the system. The value should be set in bits, you can calculate it taking 1GB plus the 256MB and multiplying the result for 1024 two times.
You can use this command to calculate, replace the first 1024 with the MB set to postgres and the 256 with the MB set for the system
echo $(( (1024 + 256) * 1024 * 1024 ))
Edit the /etc/sysctl.d/40-openbravo.conf
sudo nano /etc/sysctl.d/40-openbravo.conf
Set the shmmax parameter with the previously calculated value, for example with 1GB for postgres and 256MB for system will be:
kernel.shmmax = 1342177280
This value will be loaded in the next system start, for load this value without need to reboot:
sudo sysctl -p /etc/sysctl.d/40-openbravo.conf
To get the new values is needed to restart postgres, but remember that before stop postgres it is needed to stop tomcat
sudo /etc/init.d/tomcat stop
sudo /etc/init.d/postgresql restart
sudo /etc/init.d/tomcat start
ℹ️ Catatan: If you give more to postgres more memory than the one that the system has free it will show a "requested shared memory size overflows size_t" error.
The swap it is a file used by the system when the RAM it is not enough so move some data to disk and when needed retrieve it to RAM.
When the system needs contiguously more memory that RAM and uses intensively the swap, the system performance falls down. But if the system goes out of memory (RAM + swap) the kernel will start killing process, and in general it is no good kill a process in a hard way, but if this process are the Postgres ones this can have a very bad end. This can be seen in dmesg with a 'Out of memory: kill process [...]'.
The recommendation is configure the memory of tomcat and postgres so they don't need to use the swap that will drop down the performance. But have enough swap that in a special situation the system uses the swap and don't end with the kernel killing processes.
Execute this to create a swap of 2048 MB stored in /var/swap:
dd if=/dev/zero of=/var/swap bs=1M count=2048
mkswap /var/swap
chown root:root /var/swap
chmod 0600 /var/swap
swapon /var/swap
Note: this will be lost in the next reboot, but you can add to /etc/rc.local before the 'exit 0' so it is executed in each boot.
In Amazon EC2 the root disk / it is small but usually there is an ephemeral disk mounted in /mnt with plenty of space. Also this ephemeral is local to the instance and is quicker than /, but it is deleted on reboot. This ephemeral it is a good option to place the swap:
dd if=/dev/zero of=/mnt/swap bs=1M count=2048
mkswap /mnt/swap
chown root:root /mnt/swap
chmod 0600 /mnt/swap
swapon /mnt/swap
Note: this will be lost in the next reboot, but you can add to /etc/rc.local before the 'exit 0' so it is executed in each boot.
DEVICE_NAME: use command 'ip a' to know the name of device to be configured.
Open the network config file
sudo nano /etc/netplan/01-network-manager-all.yaml
To use DHCP with Netplan, the configuration file would look something like this:
network:
version: 2
renderer: networkd
ethernets:
DEVICE_NAME:
Addresses: []
dhcp4: true
optional: true
Test the Configuration
This command will validate the configuration before applying it. Netplan should succeed and apply the DHCP configuration. You could then issue the ip a command, get the dynamically assigned address
sudo netplan try
Apply the New Configuration
sudo netplan apply
Open the network config file
sudo nano /etc/netplan/01-network-manager-all.yaml
network:
Version: 2
Renderer: networkd
ethernets:
DEVICE_NAME:
Dhcp4: yes/no
Addresses: [IP/NETMASK]
Gateway: GATEWAY
Nameservers:
Addresses: [DNS-1, DNS-2]
Test the Configuration
This command will validate the configuration before applying it. If it succeeds, you will see Configuration accepted.
sudo netplan try
Apply the New Configuration
sudo netplan apply
Elastic IP addresses are static IP addresses that you can dynamically assign to the instance you choose. This is very useful for fast instance recovery. Example scenario:
To allocate a new static IP click on the Elastic IP item in the left navigation menu. And then select click on Allocate new Address.
You can then associate this IP address to the instance you choose, by right clicking in that IP address:
WARNING: using Elastic IPs is free or charge, as long as the IPs are associated to an instance. Otherwise you'll be penalized with an hourly fee.
Note: the hostname should be added to the /etc/hosts to avoid undesired side effects.
Edit the file /etc/hostname
sudo nano /etc/hostname
Change the current value with the new one.
Load the configuration the file
sudo hostname -F /etc/hostname
Add the hostname to /etc/hosts
sudo nano /etc/hosts
Edit the line
127.0.0.1 localhost
Add at the end a space and the new hostname
127.0.0.1 localhost newhostname
The folder with the Apache configuration is /etc/apache2
Usually not needed to restart it
sudo /etc/init.d/apache2 restart
If you only want apache to take new configuration, sometimes it is enough doing a reload
sudo /etc/init.d/apache2 reload
This guide is not intended to give a full tutorial of how to monitor a linux server, but to provide a simple list of the typical tools that are used, in order to give a start point.
Top, displays the processes that use more cpu on the system:
top
Note: press 'q' to exit, for more info about top run 'man top'.
With top can be seen the machine load (at top right) or if the disk it is highly used (if the waiting percentage it is continuously high) and the cpu and ram used by each process.
Ps, list process, a typical call:
ps faux
Also it is posible to redirect the output to less so it is more easy to read:
ps faux | less
Note: to exit from less press 'q', you can use the arrows to navigate.
Free, list memory usage
free -m
Note: Total memory it is 'Mem' row and 'total' column . Free memory it is 'buffers/cache' row and 'free' column.
A more advance topic it is to see the memory usage inside tomcat:
You can use jps to list the java processes:
jps
The tomcat processes are named with 'Bootstrap', select the pid and you can use jmap to see the heap configuration:
sudo jmap <bootstrap_pid>
You can see here the current heap size (the sum of the capacities of eden, from, to and ps old) and the max size of the heap (MaxHeapSize).
When the current heap size it is the same as the max heap size and all the space at usage are near 99% specially the ps old, then you should consider increasing the maximum heap size, take a look to [memory guide](/Installation/Appliance/Howto#Memory).
With jmap also can be monitored the current permgen size (PS Perm Generation, capacity), the max permgen size (MaxPermSize) and the usage of the current perm (PS Perm Generation, % used). Normally with 256MB it is not needed to increase it in almost any situation, you can see that usually the usage of the perm it is 99% but the size has not expand to the max allowed.
There is programs like munin that collect statistics along time of the cpu usage, system load, database, memory , etc.
This kind of tools helps to analize when the system it is more used, and help to decide if it is needed a server with more performance or in the other side if the current server it is able to handle all the load.
To be documented how to install and configure it.
There is other programs like nagios that can be configured to send email notifications when the server is down, or the disk it is almost full, the system load it is very high, etc.
To be documented how to install and configure it.
The system can be configured to send email notifications when a scheduled backup has failed or in other situations.
To be documented how to configure it.
Screen is a program that creates a virtual console, it is very useful when executing commands through ssh that takes long time to execute.
Lets put the example that you want run a restore of a big database dump of many gigabytes, this process can take many hours. If you run this through ssh and the ssh gets close because a micro network cut, then you need to restart the process from the beginning.
With screen you can execute a process, close your ssh, and connect again by ssh and re-attach to the screen virtual console.
Lets see the basic screen commands. To create a new screen:
screen
Press 'space' or 'enter' to close the welcome message.
Now you can execute any process inside the screen.
You can deattach from the screen with:
ctrl + a d
Note: press 'ctrl' and 'a' together, then release and press 'd'.
You can close even you ssh connection, and connect again.
For attach again to the screen:
screen -r
To list the screens:
screen -ls
To terminate a screen, the same that a normal console: being inside the screen execute 'exit'.
Remember that if there are updates for PostgreSQL or Tomcat those services will be restarted, so do those updates when nobody is working on the server.
sudo apt-get update
sudo /etc/init.d/tomcat stop
sudo apt-get dist-upgrade
sudo reboot # recommended, to be sure all affected services are restarted
Notes about updates:
The command that perform a major release upgrade it is 'do-release-upgrade'
Do 'NOT' execute this command !!
Direct upgrades from Appliances 12.04 to 14.04 or 14.04 to 18.04 are NOT supported. Instead do a [migration](/Installation/Appliance/Migration).
It is not a good idea to change the date or time of the server, this usually leads to undesired side effects.
If you want you server to have the time updated use [NTP](/#Configure_NTP), this program will do small update of the time in order to try to not affect the rest of processes.
If you are in a different time zone, [change the timezone of the server](/Installation/Appliance/Config#Change_timezone), this updates all the dates of the system (db, files, etc) so it will cause less problems that change date or time of the server.
ℹ️ Catatan:
Changing the date of the server can produce really undesired effects, including Openbravo stop working and data corruption. So it is highly discourage to change the date or time of the system.If you still want to change the date or time on your own risk, you can use this command:
sudo date nnddhhmmyyyy
Verify if change worked correctly: both of the following commands should show the same time matching the time change
date # system date and time
psql -h localhost -U tad openbravo -c 'select now()' # postgres date and time
NTP is a TCP/IP protocol for synchronising time over a network. Basically a client requests the current time from a server, and uses it to set its own clock.
To install it:
sudo apt-get install ntp
NTP by default will do only small time adjustments, so big time differences can take some time to synchronize.
ℹ️ Catatan:
Running a halt in EC2 depending of the instance configuration can cause theterminationwithout undo option of the instance.
To halt the system and power down the system run
sudo halt -p
To reboot the system
sudo reboot