GBase 8a 单机安装方法手顺

GBase 8a单机免费版安装,请先按照默认值操作,确保能正常安装使用。本文采用官方免费版本GBase8a-NoLicense-Free-8.6.2_build43-R7-redhat7.3-x86_64.tar.bz2为例,介绍单机版安装步骤。

前提

请确认你的操作系统是redhat 7系列。

[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)
[root@localhost ~]#

创建用户

我这里是gbase8用户。如果你已经有自己的用户,则无需创建了。

[root@localhost ~]# useradd  gbase8 -m
[root@localhost ~]# chown gbase8:gbase8 GBase8a-NoLicense-Free-8.6.2_build43-R7-redhat7.3-x86_64.tar.bz2

将安装包复制到你的用户主目录下面

比如我例子中的/home/gbase/gbase8下面。本例是我通过root上传,然后mv过去的。请根据自己的情况,将安装包放过去。

注意之后我们都是在自己的gbase8用户下操作

[root@localhost ~]# mv GBase8a-NoLicense-Free-8.6.2_build43-R7-redhat7.3-x86_64.tar.bz2  /home/gbase8/
[root@localhost ~]# su -  gbase8
[gbase8@localhost ~]$ ll
total 34804
-rw-r--r-- 1 gbase8 gbase8 35638083 Sep  4 05:50 GBase8a-NoLicense-Free-8.6.2_build43-R7-redhat7.3-x86_64.tar.bz2

解压缩安装包

[gbase8@localhost ~]$ tar -xvf GBase8a-NoLicense-Free-8.6.2_build43-R7-redhat7.3-x86_64.tar.bz2
GBaseInstall/
GBaseInstall/docs/
GBaseInstall/clear.sh
GBaseInstall/license.txt
GBaseInstall/Install_lin.sh
GBaseInstall/install_config/
GBaseInstall/install_config/.gbase.properties
此处省略一大堆解压缩信息

查看readme.txt

redame.txt里有常见的操作信息,包括安装,启动停止,登陆等,

[gbase8@localhost GBaseInstall]$ cat readme.txt
Guide:

1. To install
$ cd GBaseInstall
$ sh ./Install_lin.sh
$ source ~/.bashrc

2. To start&stop GBase
$ gbase.server start
$ gbase.server stop
$ gbase.server restart

3. To use GBase
$ gbase -uroot

4. To list all instance
$ cat $HOME/.gbase8a.properties_instance

5. To uninstall:
$ cd <installPath>
$ sh .server/bin/Uninstall_lin.sh

6. To Update
$ cd GBaseInstall
$ sh ./Install_lin.sh -U
$ source ~/.bash_profile
[gbase8@localhost GBaseInstall]$

安装

Install_lin.sh是安装脚本

其中所有的选项,我们都采用默认值即可,不需要修改。其中
安装目录默认是 /home/gbase8/GBase
默认的实例名是 gbase8a
默认端口是 5258

[gbase8@localhost GBaseInstall]$ ./Install_lin.sh

*********************************************************************************
Thank you for choosing GBase product!
省略许可内容
*********************************************************************************
Do you accept the above licence agreement (Yes/No, default=No) ?
yes

*********************************************************************************
                     Welcome to install GBase products
*********************************************************************************
Please input the GBase software installation directory (Default:/home/gbase8/GBase):


Installing all software packages ...

Software packages installation done.

*********************************************************************************
                  Welcome to create GBase database instance
*********************************************************************************
Please input the new database instance name (default: gbase8a):


Please input the port number for the new database instance (default:5258):

GBase is creating the New 'gbase8a' instance ...

hostkey: c9b28eccaed0efbfac9ceda2e992aeec
The host key file is genarate at GBASE_BASE/config/gbase_host.cnf.


Congratulations.  Your GBase installation is successful.

Please execute $source ~/.bashrc manually on the first run.

Please refer to the product's manuals and readme.txt to start using GBase product.

查看下我们安装后的目录

[gbase8@localhost GBaseInstall]$ cd /home/gbase8/GBase
[gbase8@localhost GBase]$ ll
total 8
drwxrwxr-x 2 gbase8 gbase8   56 Sep  4 05:54 config
drwxrwxr-x 2 gbase8 gbase8    6 Sep  4 05:54 docs
drwxrwxr-x 2 gbase8 gbase8  101 Sep  4 05:54 install_config
drwxrwxr-x 3 gbase8 gbase8   37 Sep  4 05:54 install_templet
-rw-r--r-- 1 gbase8 gbase8 3351 Sep  4 05:54 license.txt
drwxrwxr-x 3 gbase8 gbase8   21 Sep  4 05:54 log
drwxrwxr-x 2 gbase8 gbase8    6 Sep  4 05:54 misc
-rw-rw-r-- 1 gbase8 gbase8  446 Sep  4 05:54 readme.txt
drwxrwxr-x 7 gbase8 gbase8   72 Sep  4 05:54 server
drwxrwxr-x 4 gbase8 gbase8   49 Sep  4 05:54 tmpdata
drwxrwxr-x 3 gbase8 gbase8   21 Sep  4 05:54 userdata
[gbase8@localhost GBase]$

加载环境变量

环境变量在~/.bashr 里面,我们直接加载这个文件。

[gbase8@localhost GBaseInstall]$ source ~/.bashrc

看一下这个文件的内容,内部是加载/home/gbase8/.gbase_profile的。查看下.gbase_profile内容,都是环境变量相关的。

重要提示:数据库运行必须有响应的环境变量。

[gbase8@localhost GBaseInstall]$ cat ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -f "/home/gbase8/.gbase_profile" ]; then
. "/home/gbase8/.gbase_profile"
fi
[gbase8@localhost GBaseInstall]$ cat ~/.gbase_profile
export GBASE_BASE=/home/gbase8/GBase
export GBASE_HOME=/home/gbase8/GBase/server
export GBASE_SID=gbase8a
export PATH=$GBASE_HOME/bin:$PATH
export TCMALLOC_AGGRESSIVE_DECOMMIT=1
export LD_LIBRARY_PATH=$GBASE_HOME/lib/gbase/:$LD_LIBRARY_PATH
export TERMINFO=$GBASE_HOME/share/terminfo
[gbase8@localhost GBaseInstall]$

启动数据库服务


[gbase8@localhost GBaseInstall]$ gbase.server start
Starting GBase. SUCCESS!

登陆数据库并测试建库建表等操作

[gbase8@localhost GBaseInstall]$ gccli
bash: gccli: command not found...
[gbase8@localhost GBaseInstall]$ gbase

GBase client Free Edition 8.6.2.43-R7-free.110605. Copyright (c) 2004-2020, GBase.  All Rights Reserved.

gbase> create database testdb;
Query OK, 1 row affected (Elapsed: 00:00:00.00)

gbase> use testdb;
Query OK, 0 rows affected (Elapsed: 00:00:00.00)

gbase> create table t1(id int,name varchar(100));
Query OK, 0 rows affected (Elapsed: 00:00:00.04)

gbase> insert into t1 valeus(1,'First');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your GBase server version for the right syntax to use near 'valeus(1,'First')' at line 1
gbase> insert into t1 values(1,'First');
Query OK, 1 row affected (Elapsed: 00:00:00.05)

gbase> insert into t1 values(2,'第二名');
Query OK, 1 row affected (Elapsed: 00:00:00.05)

gbase> select * from t1;
+------+-----------+
| id   | name      |
+------+-----------+
|    1 | First     |
|    2 | 第二名    |
+------+-----------+
2 rows in set (Elapsed: 00:00:00.00)

gbase> exit
Bye

总结

至此,GBase 8a单机免费版已经顺利完成了。

单机版下载地址

http://www.gbase8a.com/Topic/173

发表评论

您的电子邮箱地址不会被公开。