新聞中心
Ubuntu是一種廣泛使用的Linux操作系統(tǒng)。由于其開放源代碼、穩(wěn)定、安全等特點,已經(jīng)成為了許多數(shù)據(jù)庫管理系統(tǒng)的首選操作系統(tǒng)。而在Ubuntu上安裝數(shù)據(jù)庫也非常簡單,本文將會為您介紹Ubuntu數(shù)據(jù)庫的下載及安裝教程。

十多年的富裕網(wǎng)站建設(shè)經(jīng)驗,針對設(shè)計、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。營銷型網(wǎng)站建設(shè)的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整富裕建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計,從而大程度地提升瀏覽體驗。創(chuàng)新互聯(lián)從事“富裕網(wǎng)站設(shè)計”,“富裕網(wǎng)站推廣”以來,每個客戶項目都認(rèn)真落實執(zhí)行。
一、下載數(shù)據(jù)庫
1.1 在線下載
在Ubuntu的官方站點上,你可以找到多個類型和版本的數(shù)據(jù)庫。如果你想在線下載,那么打開終端窗口,執(zhí)行以下命令:
$ sudo apt-get install mysql-server
這將下載并安裝最新版本的MySQL數(shù)據(jù)庫。
1.2 離線下載
如果你的服務(wù)器沒有網(wǎng)絡(luò)連接,那么可以選擇離線下載方式。建議使用官方站點上的Cubrid和MariaDB(相對于不受信任的外部下載源)。
在你的桌面上創(chuàng)建一個新的目錄,再到數(shù)據(jù)庫的官方網(wǎng)站上下載你需要的版本。將它們保存到你剛剛創(chuàng)建的目錄中。
二、安裝數(shù)據(jù)庫
2.1 安裝MySQL
安裝MySQL非常簡單,只需運行以下命令即可:
$ sudo apt-get install mysql-server
在安裝過程中,系統(tǒng)會要求你設(shè)置MySQL管理員的密碼。請記住這個密碼,它會在你安裝任何MySQL客戶端并連接到數(shù)據(jù)庫時用到。
2.2 安裝PostgreSQL
和MySQL安裝 PostgreSGL也是非常簡單的。我們先使用以下命令更新apt-get的軟件倉庫:
$ sudo apt-get update
然后運行以下命令安裝PostgreSQL:
$ sudo apt-get install postgresql postgresql-contrib
在安裝過程中,系統(tǒng)會提示你輸入PostgreSQL管理員的密碼。請記住這個密碼,之后會用到。
2.3 安裝MongoDB
安裝MongoDB也是很簡單的。運行以下命令來安裝:
$ sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 7F0CEB10
$ echo “deb http://repo.mongodb.org/apt/ubuntu “$(l_release -sc)”/mongodb-org/3.0 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
$ sudo apt-get update
$ sudo apt-get install -y mongodb-org
安裝完成后,你只需要運行以下命令即可啟動MongoDB:
$ sudo service mongod start
三、配置數(shù)據(jù)庫
安裝完成后,你需要配置數(shù)據(jù)庫以便能夠正常使用。一般來說,如果你使用的是Linux的基本安裝,那么你的數(shù)據(jù)庫應(yīng)該已經(jīng)有了基本的配置。
如果你想進(jìn)一步配置數(shù)據(jù)庫,請按照以下步驟:
3.1 配置MySQL
MySQL的默認(rèn)配置非常安全。但是如果你想進(jìn)一步保護(hù)它,你可以做出以下幾個配置:
從遠(yuǎn)程訪問MySQL
默認(rèn)情況下,只有本地用戶能夠訪問MySQL。如果你想從遠(yuǎn)程訪問MySQL,可以修改以下文件:
$ nano /etc/mysql/mysql.conf.d/mysqld.cnf
然后在[mysqld]段中添加以下行:
bind-address = 0.0.0.0
回到終端,重啟MySQL:
$ sudo service mysql restart
3.2 配置PostgreSQL
PostgreSQL的默認(rèn)配置也是非常安全的,但是如果你想進(jìn)一步保護(hù)它,你可以做出以下幾個配置:
修改PostgreSQL監(jiān)聽的端口
PostgreSQL默認(rèn)監(jiān)聽5432端口。你可以在以下文件中修改這個端口:
$ sudo nano /etc/postgresql/13/mn/postgresql.conf
在該文件中找到以下行:
#listen_addresses = ‘localhost’
并將它修改為:
listen_addresses = ‘*’
這將使PostgreSQL監(jiān)聽所有網(wǎng)絡(luò)接口。完成后,請保存并退出該文件。
通過以下命令重啟PostgreSQL:
$ sudo service postgresql restart
3.3 配置MongoDB
MongoDB默認(rèn)情況下使用27017端口。你可以在/etc/mongod.conf文件中進(jìn)行端口的修改:
$ sudo nano /etc/mongod.conf
找到:
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
并將bindIp修改為0.0.0.0。
重啟MongoDB使配置生效:
$ sudo systemctl restart mongod
四、連接數(shù)據(jù)庫
安裝和配置完數(shù)據(jù)庫后,你就可以開始連接數(shù)據(jù)庫了。以下是連接MySQL、PostgreSQL和MongoDB的方法:
4.1 連接MySQL
使用以下命令連接MySQL:
$ mysql -u root -p
然后輸入之前設(shè)置的MySQL管理員密碼。之后就可以開始使用MySQL了。
4.2 連接PostgreSQL
使用以下命令連接PostgreSQL:
$ sudo -u postgres psql
輸入之前設(shè)置的PostgreSQL管理員密碼。之后就可以開始使用PostgreSQL了。
4.3 連接MongoDB
使用以下命令連接MongoDB:
$ mongo
接下來你就可以通過MongoDB Shell進(jìn)入交互式操作界面來對數(shù)據(jù)庫進(jìn)行配置或操作。
至此,你已經(jīng)成功地在Ubuntu上安裝了MySQL、PostgreSQL和MongoDB數(shù)據(jù) 庫,并完成了一些簡單的配置和連接操作。根據(jù)實際需要,你還可以訂制更多的功能和選項。不過,希望我們介紹的內(nèi)容能夠幫助你成功地安裝、配置、連接數(shù)據(jù)庫。
相關(guān)問題拓展閱讀:
- 求一個能安裝在Linux系統(tǒng)Ubuntu 上面的Oracle 10g 64 位 數(shù)據(jù)庫,跪求
求一個能安裝在Linux系統(tǒng)Ubuntu 上面的Oracle 10g 64 位 數(shù)據(jù)庫,跪求
之一步,安裝必須的包:
32位安裝:
apt-get install gcc make binutils lesstif2 libc6 libc6-dev rpm libmotif3 libaio1 libstdc++6 alien
64位安裝:
sudo apt-get install gcc libaio1 lesstif2 lesstif2-dev make libc6 libc6-i386 libc6-dev-i386 libstdc++5 lib32stdc++6 lib32z1 ia32-libs
第二步攜卜,添加用戶:
# adduser oracle
正辯槐穗在添加用戶”oracle”…
正在添加新組”oracle” (1001)…
正在添加新用戶”oracle” (1002) 到組”oracle”…
創(chuàng)建主目錄”/home/oracle”…
正在從”/etc/skel”復(fù)制文件…
輸入新的 UNIX 密碼:
重新輸入新的 UNIX 密碼:
passwd:已成功更新密碼
Changing the user information for oracle
Enter the new value, or press ENTER for the default
Full Name : oracle
Room Number :
Work Phone :
Home Phone :
Other :
第三步,修改設(shè)置
A.設(shè)置swap區(qū)
Oracle10g至少需要500M的內(nèi)存和400M的交明空換空間,要查看swap區(qū)是否足夠大小,用 fdisk -l 命令去查,如果小于400M的空間,那么就要增加swap的大小 重設(shè)交換分區(qū)可以使用如下操作:
dd if=/dev/zero of=tmp_swap bs=1k count=900000
chmod 600 tmp_swap
mkswap tmp_swap
swapon tmp_swap
完成安裝以後,可以釋放這個空間:
swapoff tmp_swap
rm tmp_swap
count 值是根據(jù)你需要調(diào)整的交換分區(qū)大小而定。
B.修改 sysctl.conf
添加如下的行到/etc/sysctl.conf 中:
kernel.shmmax =
kernel.shmmni = 4096
kernel.shmall =
kernel.sem = 128
fs.file-max = 65536
net.ipv4.ip_local_port_range =
C.修改 limits.conf
添加如下的行到/etc/security/limits.conf中:
* soft nproc 2407
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
D.讓修改生效
修改了以上文件後,必須讓其生效,或重啟系統(tǒng),或切換到 root 用戶下用以下的方式改變內(nèi)核運行參數(shù): sysctl -p
E.產(chǎn)生相應(yīng)的軟連接
創(chuàng)建一個文件如 kk,內(nèi)容如下:
#!/bin/bash
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename
mkdir /etc/rc.d
ln -s /etc/rc0.d /etc/rc.d/rc0.d
ln -s /etc/rc2.d /etc/rc.d/rc2.d
ln -s /etc/rc3.d /etc/rc.d/rc3.d
ln -s /etc/rc4.d /etc/rc.d/rc4.d
ln -s /etc/rc5.d /etc/rc.d/rc5.d
ln -s /etc/rc6.d /etc/rc.d/rc6.d
ln -s /etc/init.d /etc/rc.d/init.d
創(chuàng)建後,切換到 root 用戶去執(zhí)行一下。
F.創(chuàng)建RedHat的版本聲明文件
在/etc/redhat-release中添加以下語句,以使安裝程序認(rèn)為正在一個RedHat的系統(tǒng)上安裝:
Red Hat Linux release 3.1 (drupal)
G.修改環(huán)境變量
編輯 /home/oracle/.bashrc,增加以下export 的內(nèi)容。 (注意,在Ubnutu 7.04中用戶的profile文件已改名為~/.profile,有很多安裝教程都是用 ~/.bash_profile,在7.04中不行的)
export ORACLE_HOME=/opt/ora10
export ORACLE_OWNER=oracle
export ORACLE_SID=ora1
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
第四步,開始安裝
注銷原來的用戶,改用oracle用戶登錄。用env查看一下環(huán)境變量是否生效。 然後進(jìn)行/ora_ins_disk中進(jìn)行安裝,執(zhí)行安裝腳本時還需要以root權(quán)限創(chuàng)建目錄/opt/ora10
sudo mkdir /opt/ora10
sudo chown -R oracle:oracle /opt/ora10
sudo chmod -R 770 /opt/ora10
cd/ora_ins_disk
./runInstaller
在安裝過程中,請使用 Advanced Installation,然後一路按默認(rèn)的設(shè)置進(jìn)行往下設(shè)置,到窗單名為 “Specify Database Configuration Options”的時候,要修改以下設(shè)置: Database Character Set 中選擇 Simplified Chinese ZHS16GBK 在安裝的後期,系統(tǒng)提示需要用 root 用戶去運行兩個腳本文件orainstRoot.sh和root.sh,安裝完畢後,Oracle是正常啟動著的,你可以試一下連接數(shù)據(jù)庫,同時也可以使用瀏覽器去設(shè)置一下Oracle,(url:http: //localhost:1158/em/)(Oracle 10g與之前的版本都不一樣,使用WEB頁的企業(yè)管理器來代替以前的C/S版JAVA企業(yè)管理器)
第六步,設(shè)置自啟動
創(chuàng)建自啟動腳本 創(chuàng)建 oracledb 腳本到/etc/init.d/oracledb,內(nèi)容如下
#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
export ORACLE_HOME=/opt/ora10
export ORACLE_SID=ora1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
ORA_OWNR=”oracle”
# if the executables do not exist — display error
if
then
echo ” dbstart command does not exist, quitting…”
exit 1
else
echo ” dbstart existance check OK”
fi
# depending on parameter — startup, shutdown, restart
# of the instance and listener or usage display
case “$1” in
start)
# Oracle listener and instance startup
echo ” Starting oracle”
echo ” su $ORA_OWNR -c “”$ORACLE_HOME/bin/lsnrctl start”
su $ORA_OWNR -c “$ORACLE_HOME/bin/lsnrctl start”
if
then
echo ” listener failed to start”
exit 1
else
echo ” listener start OK”
fi
su $ORA_OWNR -c “$ORACLE_HOME/bin/dbstart $ORACLE_HOME”
echo ” su $ORA_OWNR -c “”$ORACLE_HOME/bin/dbstart $ORACLE_HOME”
if
then
echo ” dbstart failed to start”
exit 1
else
echo ” dbstart OK”
fi
touch /var/lock/oracle
echo “su $ORA_OWNR -c “”$ORACLE_HOME/bin/emctl start dbconsole”
su $ORA_OWNR -c “$ORACLE_HOME/bin/emctl start dbconsole”
if
then
echo ” dbconsole failed to start”
exit 1
else
echo ” dbconsole start OK”
fi
echo ” Starting oracle ended OK”
;;
stop)
# Oracle listener and instance shutdown
echo ” Shutdown Oracle: “
echo ” su $ORA_OWNR -c “”$ORACLE_HOME/bin/lsnrctl stop”
su $ORA_OWNR -c “$ORACLE_HOME/bin/lsnrctl stop”
echo ” su $ORA_OWNR -c “”$ORACLE_HOME/bin/dbshut $ORACLE_HOME”
su $ORA_OWNR -c “$ORACLE_HOME/bin/dbshut $ORACLE_HOME”
rm -f /var/lock/oracle
echo “su $ORA_OWNR -c “”$ORACLE_HOME/bin/emctl stop dbconsole”
su $ORA_OWNR -c “$ORACLE_HOME/bin/emctl stop dbconsole”
echo ” Shutdown Oracle ended OK”
;;
reload|restart)
echo “: $1 oracle”
$0 stop
$0 start
;;
*)
echo ” Unknown context: $1″
echo ” Usage: `basename $0` start|stop|restart|reload”
exit 1
esac
exit 0
設(shè)置權(quán)限,放到啟動腳本中去
chmod 755 /etc/init.d/oracledb
update-rc.d oracledb defaults 99
還需要編輯一下/etc/oratab,把其中的N改成Y,不然上述腳本中所調(diào)用的$ORACLE_HOME/bin/dbstart在執(zhí)行時不會自動啟動相應(yīng)的數(shù)據(jù)庫實例(這里的數(shù)據(jù)庫實例是ora1)。文件內(nèi)容如下:
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ‘:’, is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, ‘#’, are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , “Y”, or should not,
# “N”, be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
ora1:/opt/ora10:Y
我的 oralce 的安裝盤中可能有些問題,所以如果只用上述的腳本是不能啟動 listener的,要修改一下: 修改 /opt/ora10/bin/dbstart文件 查找:(本步驟修改后需重新安裝?——(不需要重新安裝呀Sutra 2023年6月10日 (四) 21:31 (CST)))
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
將其改為:
# Set this to bring up Oracle Net Listener
ORACLE_HOME_LISTNER=$ORACLE_HOME
設(shè)置後,測試一下
/etc/init.d/./oracledb reload
ubuntu數(shù)據(jù)庫下載的介紹就聊到這里吧,感謝你花時間閱讀本站內(nèi)容,更多關(guān)于ubuntu數(shù)據(jù)庫下載,Ubuntu數(shù)據(jù)庫下載:安裝教程,求一個能安裝在Linux系統(tǒng)Ubuntu 上面的Oracle 10g 64 位 數(shù)據(jù)庫,跪求的信息別忘了在本站進(jìn)行查找喔。
香港服務(wù)器選創(chuàng)新互聯(lián),2H2G首月10元開通。
創(chuàng)新互聯(lián)(www.cdcxhl.com)互聯(lián)網(wǎng)服務(wù)提供商,擁有超過10年的服務(wù)器租用、服務(wù)器托管、云服務(wù)器、虛擬主機、網(wǎng)站系統(tǒng)開發(fā)經(jīng)驗。專業(yè)提供云主機、虛擬主機、域名注冊、VPS主機、云服務(wù)器、香港云服務(wù)器、免備案服務(wù)器等。
網(wǎng)站名稱:Ubuntu數(shù)據(jù)庫下載:安裝教程(ubuntu數(shù)據(jù)庫下載)
網(wǎng)站鏈接:http://fisionsoft.com.cn/article/cdsdeoi.html


咨詢
建站咨詢
