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.
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.
CUBRID installation packages on Launchpad are available for Ubuntu 10.04 (Lucid Lynx), Ubuntu 10.10 (Maverick Meerkat), Ubuntu 11.04 (Natty Narwhal), Ubuntu 11.10 (Oneiric Ocelot), Ubuntu 12.04 (Precise Pangolin), Ubuntu 12.10 (Quantal Quetzal) and Ubuntu 13.04 (Raring Ringtail).
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:
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:
sudo apt-get install php5-cubrid
Other versions: php5-cubrid-8.4.0 (for CUBRID 8.4.0) or php5-cubrid-8.3.1 (for CUBRID 8.3.1).
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 CUBRIDTo 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
sudo su -s $SHELL cubrid
The CUBRID service offers several commands that can be run from the root user or by preceding all commands with sudo.
- Start Server: service cubrid start
- Stop Server: service cubrid stop
- Restart Server: service cubrid restart
- View Status: service cubrid status (option since CUBRID 8.4.0)
Since CUBRID 8.4.1 the service also supports the following commands:
- Create Database: service cubrid createdb dbname [parameters] (more details regarding the parameters can be found here: createdb command)
- 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.
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.