CUBRID Ubuntu Launchpad Installation

The goal of this tutorial is to explain the steps required in order to install CUBRID using the Launchpad repositories. It is intended for users that have Ubuntu 10.04 or above, who want to easily install CUBRID from Ubuntu repos. This article will also show how to run a few simple commands that require root privileges.

Overview

CUBRID builds have been available on Launchpad since version 8.3.1. Now you can also install CUBRID 8.4.0 and CUBRID 8.4.1 from Launchpad. Every time a new release is announced, we will be uploading it to Launchpad.

Step 1 – Add Repository

First of all, we must add the repository to the sources list using 2 commands: add-apt-repository and apt-get-update. Both require root access so must be run either from the root console or by using the sudo command.

In case you want to install CUBRID you must add the ppa:cubrid/cubrid repository.

sudo add-apt-repository ppa:cubrid/cubrid
sudo apt-get update

Note: If add-apt-repository command is not recognized by your system, you must install the python-software-properties package.

sudo apt-get install python-software-properties

If you encounter strange python errors when running add-apt-repository, reinstall the python-software-properties package as this issue was fixed in the meantime by the Ubuntu community.

Step 2 – Installing CUBRID

In order to perform the installation after adding the repository, all we need to do is to run apt-get install with root privileges:

a) CUBRID 9.2.0

sudo apt-get install cubrid

b) CUBRID 8.4.4

sudo apt-get install cubrid-8.4.4

c) CUBRID 8.4.0

sudo apt-get install cubrid-8.4.0

d) CUBRID 8.3.1

sudo apt-get install cubrid-8.3.1

CUBRID 9.2.0 installs in the following directories:

/opt/cubrid - all the files related to the cubrid execution that cannot be modified;

/etc/opt/cubrid - all the configuration files;

/var/opt/cubrid - the databases, log files and temporary files;

/etc/profile.d/cubrid.sh - script that sets the PATH variables;

/etc/init.d/cubrid - service used to start CUBRID on runtime;

Remember: After the installation, you must log off or restart your computer in order for the CUBRID PATH variables to be set.

In case you want to use CUBRID before doing so, every time you open a new terminal window you must type the command:

. /etc/profile.d/cubrid.sh

Make sure that there is a space between the point and /etc or the command won’t work properly. This command sets the PATH variables temporarily for that terminal window. They remain set until the terminal window is closed.

Step 3 (Optional) - Installing The Demo Database

Now that we have installed cubrid, we can install the optional cubrid demodb sample database. You can find the package in the same PPA as the cubrid package.

If you have installed Cubrid 9.2.0, then you can run the command:

sudo apt-get install cubrid-demodb

This will install the demodb database and start it. In order to connect to the demodb database enter the username "dba" and a blank(empty) password. You can connect to it either from CUBRID Manager (we recommend downloading the archived version and extracting it to /opt/cubrid/cubridmanager) or from CSQL.

Installing PHP API

In case you want to access cubrid databases from within php code, then you can install the cubrid PHP API using the command below:

Installing CUBRID Python Driver (CUBRIDdb)

In case you want to access cubrid databases from within python code, then you can install the cubrid Python API using the command below:

sudo apt-get install python-cubriddb

Installing CUBRID Web Manager

Since CUBRID 8.4.4, CUBRID Web Manager is installed when you install the cubrid package. Just start up the server using:

sudo service cubrid start

To check if the connection is succesful, you can browse https://localhost:8282 to log in the web manager console.

Uninstall CUBRID

To uninstall cubrid, run
"sudo apt-get remove cubrid", "sudo apt-get remove cubrid-8.4.0" or "sudo apt-get remove cubrid-8.3.1". The same goes for all other installed packages.

The uninstall does not delete the databases located in /var/opt/cubrid/databases. If you want to completely remove the cubrid installation, just remove the folder /opt/cubrid using:

rm -rf /var/opt/cubrid/databases

CUBRID commands

CUBRID is set to autostart on boot. If you want to stop/start or perform other administrative commands such as loaddb/unloaddb, then you must connect as cubrid user using the command:

sudo su -s $SHELL cubrid

This command will open up the terminal for user cubrid in which you can run every command you require. The only requirement you need to pay attention to is that "cubrid" user must have access to the files you want it to use.

For example, when running "cubrid loaddb", the files given as parameters must be in a folder that the "cubrid" user can access and it should have permission to read the files.

Note: All the basic CUBRID commands can be ran without connecting as "cubrid" user by using the service described in the following section.

CUBRID Service

The CUBRID service offers several commands that can be run from the root user or by preceding all commands with sudo.

Delete Database: service cubrid deletedb dbname (dbname is the name of the database to be deleted)

Start Database: service cubrid start dbname

Stop Database: service cubrid stop dbname

Restart Database: service cubrid restart dbname

Remember: If you encounter the error "cubrid: command not found", then run ". /etc/profile.d/cubrid.sh" to set the PATH variables for CUBRID.

Important! The output of the last service command ran is saved to /var/opt/cubrid/tmp/service.cubrid. If you encounter the message [fail] when running a service command, check the output to see the reason the command failed. If you encounter any problems solving the issue, please check out the Getting Help section below and post a question including the output of the command.

Summary

This concludes the CUBRID Launchpad tutorial. We hope that you found this tutorial useful and that it helped you understand how to install, run and remove CUBRID. Let us know your feedback and remember to periodically check CUBRID Tutorials at http://www.cubrid.org/wiki_tutorials/entry/cubrid-tutorials for more tutorials and resources.

Getting Help

If you have any questions, you can post them in our Q&A site or you can post a comment on our forum.