Installing CUBRID on Fedora or Centos
The goal of this tutorial is to explain the steps required in order to install CUBRID using the CUBRID yum repositories. It is intended for users that have Fedora 13 or above, respectively Centos 6 and above, who want to easily install CUBRID from Fedora repos or Centos repos. This article will also show how to run a few simple commands that require root privileges.
CUBRID 9.1.0 is available since 01.04.2013 for Fedora 13-17 and Centos 6.0 - 6.3.
CUBRID builds are available on CUBRID yum repositories starting with CUBRID version 8.3.1. Every time a new release is announced, we will be uploading it to CUBRID yum repositories.
Setup yum to use CUBRID Repository
First of all, we must add the repository settings to yum configuration. To perform this step we prepared an RPM package customized for Fedora and CentOS distributions. RPM installation requires root access, so it must be run either from the root console or by using the sudo or su commands.
The following code will install yum settings for Fedora 17 instalation and CUBRID 8.4.1 binaries.
sudo rpm -ivh http://yumrepository.cubrid.org/cubrid_repo_settings/8.4.1/cubridrepo-8.4.1-1.fc17.noarch.rpm
- For other operating systems, replace fc17 in the url above with fc13, fc14, fc15, fc16 (for other versions of Fedora) or el6, el6.1, el6.2 (for Centos versions).
- To install yum settings for other versions of Fedora or Centos use the links from: http://www.cubrid.org/yum_repository
Using yum search cubrid a user can see a list of available CUBRID packages :
cubrid-demodb.i386 : Sample CUBRID database named demodb cubrid-devel.i386 : Development files for CUBRID database cubridrepo.noarch : Cubrid Repository Configuration php-cubrid.i386 : PHP API for CUBRID database python-cubrid.i386 : Python API for CUBRID database cubrid.i386 : An open source database highly optimized for Web applications
Since CUBRID 8.4.3, there are only 2 sets of cubrid repositories, one for Fedora 15 and above available at Fedora 15+ and one for Fedora < 15 (tested against Fedora 13 and Fedora 14) and Centos 6.0 and above (tested up to Centos 6.3) available at Centos 6.0+.
In order to perform the installation after adding the repository settings, all we need to do is to run yum install ... with root privileges:
yum install cubrid
Remember: After the installation, you must restart your computer in order for the CUBRID PATH variables to be set. If you sign out and sign in again you will obtain a similar effect faster.
In case you want to use CUBRID without restarting, 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.
Note: If you connect as a different user and the "cubrid" command is not found, then you must run the above ". /etc/profile.d/cubrid.sh" command in order to set the correct environment variables.
(Optional) Installing CUBRID Manager (CUBRID 8.4.0 or below)
Now that we have installed CUBRID, we can install the optional CUBRID Manager Server. This is needed to provide a management interface to CUBRID Manager client application. You can find the packages in the same yum repository as the CUBRID package.
yum install cubrid-manager-server
This will install the CUBRID Manager server which will load on startup alongside cubrid.
Note : In order to be able to connect from a remote machine with CUBRID Manager Client, the firewall settings may need to be changed. Please refer to 'system-config-firewall" manual for your distribution and also CUBRID settings for required ports that need to be allowed.
(Optional) Installing CUBRID sample database
CUBRID comes with a sample database named demodb. It contains 10 tables with various types of columns. In order to create this table and load its data, starting with CUBRID 8.4.1 you can run:
yum install cubrid-demodb
The CUBRID service offers several commands that can be run from the root user or by preceding all commands with "sudo -i" (-i preserves the environment variables).
- Start Server: service cubrid start
- Stop Server: service cubrid stop
- Restart Server: service cubrid restart
Since CUBRID 8.4.1 the service also supports the following commands:
- View Status: service cubrid status
- Create Database: service cubrid createdb dbname [parameters] (more details regarding the parameters can be found here: createdb command)
- Delete Database: service cubrid deletedb dbname (where dbname is the name of the database to be deleted)
- Start Database: service cubrid startdb dbname
- Stop Database: service cubrid stopdb dbname
- Restart Database: service cubrid restartdb dbname
Note: The above service commands used for CUBRID 8.4.1 are not valid for Fedora 15 and above. If you want to perform administrative commands like the ones above, you must log in as cubrid user using the command "sudo su -s $SHELL cubrid" and then execute all regular cubrid commands such as "cubrid createdb test". This approach also works for Fedora 13-14 and Centos, where the rest of the service commands are just a way to simplify database creation and handling.
Running CUBRID Commands
Congratulations! You have successfully installed CUBRID. If you want to run CUBRID commands however, there is one more thing you should take into consideration. CUBRID is installed by default into /usr/share/cubrid folder where the normal user has only read access. The conf files are saved into /etc/cubrid, while the variable files such as logs or databases in /var/cubrid.
If you want to perform administrative tasks such as all cubrid commands or "csql -S" (standalone mode), you must first log in as cubrid user using the command:
sudo su -s $SHELL cubrid
Note: The CUBRID init.d service script is by default installed into /etc/init.d/cubrid. CUBRID is set to auto-start. Use chkconfig command to change the default behavior. On Fedora 15+ the cubrid.service file is used to handle the service.
Since CUBRID 8.4.1 any error regarding service commands will be saved to /var/cubrid/tmp/service.cubrid.
Installing PHP API
In case you want to access CUBRID databases from within the php code, then you can install php-cubrid package:
yum install php-cubrid
This will automatically install dependent php packages.
Note that after installation your web server must be restarted for php to reload the modules:
service httpd restart
Installing Python API
In case you want to access CUBRID databases from within the python code, then you can install python-cubrid package:
yum install python-cubrid
This will automatically install dependent python packages.
If you want to uninstall CUBRID, the procedure is almost identical to the one for the installation. You only need to run:
yum erase cubrid
Your system will uninstall CUBRID as shown below. Note that yum will erase dependencies as well.
This concludes the tutorial for installing CUBRID on Fedora and CentOS from CUBRID yumrepository. 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/tutorials for more tutorials and resources.
AutoSet is a software bundle for Windows, which provides seamless installation of Apache, PHP, MySQL, CUBRID, and Subversion. It is distributed und...