首頁 >運維 >安全 >銀河麒麟系統安裝中間件

銀河麒麟系統安裝中間件

WBOY
WBOY轉載
2023-06-12 11:13:431821瀏覽

銀河麒麟系統安裝中間件

現在越來越多的企業級應用需要運行在國產化環境中,本文介紹下我們產品使用的中間件在國產操作系統銀河麒麟的安裝(不一定是最優方式,但能用)。

包含;Nginx、Redis、RabbitMQ、MongoDB、dotNETCore。

下圖是銀河麒麟伺服器的資訊:

銀河麒麟系統安裝中間件

#想要順利安裝需要確保:

1 、伺服器能存取網路。想要完全離線的方式安裝會更複雜,需要進一步研究。

2、修改  yum  來源。

使用 vi /etc/yum.repos.d/kylin_aarch64.repo 來設定 yum  來源,檔案內容如下:

###Kylin Linux Advanced Server 10 - os repo###[ks10-adv-os]name = Kylin Linux Advanced Server 10 - Osbaseurl = https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/base/$basearch/gpgcheck = 1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylinenabled = 1[ks10-adv-updates]name = Kylin Linux Advanced Server 10 - Updatesbaseurl = https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/updates/$basearch/gpgcheck = 1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylinenabled = 1[ks10-adv-addons]name = Kylin Linux Advanced Server 10 - Addonsbaseurl = https://update.cs2c.com.cn/NS/V10/V10SP3/os/adv/lic/addons/$basearch/gpgcheck = 1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-kylinenabled = 0

Nginx

#先執行下方指令安裝相依:

yum install gcc gcc-c++ make unzip pcre pcre-devel zlib zlib-devel libxml2 libxml2-develreadline readline-devel ncurses ncurses-devel perl-devel perl-ExtUtils-Embed openssl-devel -y

下載原始碼:

wget -c http://nginx.org/download/nginx-1.20.1.tar.gztar -zxvfnginx-1.20.1.tar.gz -C /optcd/opt/nginx-1.20.1/

設定:

./configure \--with-http_ssl_module \--with-http_flv_module \--with-http_stub_status_module \--with-http_gzip_static_module \--with-pcre

安裝:

make -j2 && make install

進入/usr/local/nginx/sbin/ 目錄,執行下方指令啟動服務:

./nginx -c /usr/local/nginx/conf/nginx.conf

執行ps -ef | grep nginx 查看nginx 進程:

銀河麒麟系統安裝中間件

##redis

安裝依賴:

yum install cpp binutils glibc glibc-kernheaders glibc-common glibc-devel -y
下載原始碼:

cd /usr/local/srcwget http://download.redis.io/releases/redis-6.0.2.tar.gztar -zxvf redis-6.0.2.tar.gz -C /opt
編譯安裝:

cd /opt/redis-6.0.2make
執行:

mkdir logs nohup /opt/redis-6.0.2/src/redis-server /opt/redis-6.0.2/redis.conf >> /opt/redis-6.0.2/logs/redis.log2>&1 &
RabbitMQ

#RabbitMQ  的安裝比較簡單,執行幾個指令就行。

安裝:

yum install socat logrotate -yyum -y install erlang -yyum -y install rabbitmq-server
啟動服務:

systemctl enable rabbitmq-serversystemctl start rabbitmq-server
如果想要使用瀏覽器存取 RabbitMQ 的管理介面,則需要啟用外掛程式:

rabbitmq-plugins enable rabbitmq_management
外掛程式啟用後,就可以在瀏覽器中輸入:htp://ip:15672 進行存取了,15672  連接埠需要在防火牆開放。

MongoDB

因為上面的中間件已經安裝了部分依賴,所以執行下面指令安裝剩餘相依性即可:

sudo yum -y install libcurl-devel openssl libxml2-devel libxml2 glibc-static libstdc++-static libffi-devel
安裝 Python

Python安裝的是 2.x  版本,因為這裡 MongoDB  使用的是 3.6.19  版本。

cd /usr/local/srcwget https://www.python.org/ftp/python/2.7.17/Python-2.7.17.tgztar -zxvf Python-2.7.17.tgzcd Python-2.7.17./configure --prefix=/usr/local/python2make -j64make installln -s /usr/local/python2/bin/python2.7 /usr/local/bin/python2.7
安裝setuptools 工具

cd /usr/local/srcwget https://github.com/pypa/setuptools/archive/v41.0.1.zipunzip setuptools-v41.0.1.zipcd setuptools-41.0.1/usr/local/bin/python2.7 bootstrap.py/usr/local/bin/python2.7 setup.py install

安裝pip  工具

cd /usr/local/srcwget https://github.com/pypa/pip/archive/19.2.2.tar.gztar zxvf pip-19.2.2.tar.gzcd pip-19.2.2/usr/local/bin/python2.7 setup.py install

安裝 mongo

cd /usr/local/srcwget https://github.com/mongodb/mongo/archive/r3.6.19.tar.gztar -zxvf mongo-r3.6.19.tar.gzcd mongo-r3.6.19#构建编译环境/usr/local/python2/bin/pip2 install -r buildscripts/requirements.txt#创建数据目录mkdir -p /data/db#安装/usr/local/bin/python2.7 buildscripts/scons.py --prefix=/opt/mongo install MONGO_VERSION=3.6.19 CCFLAGS="-march=armv8-a+crc" --disable-warnings-as-errors --variables-files=etc/scons/propagate_shell_environment.vars#创建软连接ln -s /opt/mongo/bin/mongo /usr/local/bin/mongoln -s /opt/mongo/bin/mongod /usr/local/bin/mongod

    #--prefix=/opt/mongo 為安裝目錄
執行上面指令如果沒有出現任何錯誤,就安裝成功了,執行下面指令進行服務端的後端啟動:

nohup mongod >> /opt/mongo/logs/mongolog 2>&1 &
dotNETCore 3.1

安裝依賴

yum install gmp-devel mpfr-devel libmpc-devel -y

執行下方指令安裝

wget https://download.visualstudio.microsoft.com/download/pr/186257d9-bca2-4dda-be74-006205965ec9/b2b63d45482701473d9731abc41ecc2a/dotnet-sdk-3.1.426-linux-arm64.tar.gzmkdir -p /opt/dotnettar -zxvf dotnet-sdk-3.1.426-linux-arm64.tar.gz -C /opt/dotnetln -s /opt/dotnet/dotnet /usr/binexport DOTNET_ROOT=/opt/dotnetexport PATH=$PATH:/opt/dotnet

執行指令 dotnet --info 進行驗證,出現下列結果表示安裝成功:

.NET Core SDK (reflecting any global.json): Version: 3.1.426 Commit:e81f6c8565Runtime Environment: OS Name: kylin OS Version:V10 OS Platform: Linux RID: linux-arm64 Base Path: /opt/dotnet/sdk/3.1.426/Host (useful for support):Version: 3.1.32Commit:f94bb2c3ff.NET Core SDKs installed:3.1.426 [/opt/dotnet/sdk].NET Core runtimes installed:Microsoft.AspNetCore.App 3.1.32 [/opt/dotnet/shared/Microsoft.AspNetCore.App]Microsoft.NETCore.App 3.1.32 [/opt/dotnet/shared/Microsoft.NETCore.App]To install additional .NET Core runtimes or SDKs:https://aka.ms/dotnet-download

以上是銀河麒麟系統安裝中間件的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:51cto.com。如有侵權,請聯絡admin@php.cn刪除