最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

docker 安裝-jdk安裝-hadoop安裝-nginx安裝-tomcat安裝

2023-08-29 20:45 作者:有你是清歡  | 我要投稿

docker 安裝-jdk安裝-hadoop安裝-nginx安裝-tomcat安裝

一、docker 安裝

1.下載文件地址:

1) https://download.docker.com/
2) https://download.docker.com/linux/static/stable/x86_64/
3)https://docs.docker.com/get-docker/

2.下載的路徑/opt/yuan/解壓縮包

[root@localhost yuan]# tar -zxvf /opt/yuan/docker-24.0.1.tgz -C /opt/module

3.將解壓出來的docker文件內(nèi)容移動到 /usr/bin/ 目錄下

cp docker/* /usr/bin/
[root@localhost module]# cp -r /opt/module/docker/* /usr/bin/

4.將docker注冊為service的文件

vi /etc/systemd/system/docker.service
vi /opt/module/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target

4.添加權(quán)限

#添加文件權(quán)限并啟動docker
chmod +x /etc/systemd/system/docker.service
[root@localhost module]# cp -r /opt/module/docker.service/* /etc/systemd/system/docker.service
[root@localhost module]# chmod +x /etc/systemd/system/docker.service

5.啟動docker

#重新加載配置文件
[root@localhost module]# systemctl daemon-reload
#啟動Docker
[root@localhost module]# systemctl start docker
#設置開機自啟
[root@localhost module]# systemctl enable docker.service

6.驗證docker

#查看Docker狀態(tài)
[root@localhost module]# systemctl status docker
#查看Docker版本
[root@localhost module]# docker -v

7.卸載

1)#通過 uname -r 命令查看你當前的內(nèi)核版本
[root@localhost module]# uname -r
2)#執(zhí)行卸載命令
[root@localhost module]# sudo yum remove docker \
? ? ? ? ? ? ? ? ?docker-client \
? ? ? ? ? ? ? ? ?docker-client-latest \
? ? ? ? ? ? ? ? ?docker-common \
? ? ? ? ? ? ? ? ?docker-latest \
? ? ? ? ? ? ? ? ?docker-latest-logrotate \
? ? ? ? ? ? ? ? ?docker-logrotate \
? ? ? ? ? ? ? ? ?docker-engine
3)#刪除 docker.service 文件
[root@localhost module]# rm -r /etc/systemd/system/docker.service

二、jdk安裝

1、下載jdk

https://www.oracle.com/java/technologies/downloads/

2、用 xftp傳輸工具將 JDK 導入到opt目錄下面的yuan文件夾下面

/opt/yuan/jdk-8u212-linux-x64.tar.gz [root@localhost ~ ]# ls /opt/ yuan

3、解壓JDK到/opt/module目錄

// 文件壓縮包解壓到指定位置 [root@localhost ~ ]# tar -zxvf jdk-8u212-linux-x64.tar.gz -C /opt/module/ [root@localhost~ ]# unzip -d /opt/module /jdk ?[root@localhost~ ]# tar -zxvf /opt/yuan/jdk-8u212-linux-x64.tar.gz -C /opt/module/

4、配置 JDK 環(huán)境變量

// 根據(jù)路徑創(chuàng)建一個文件 'vi java_jdk_profile', // [root@localhost~ ]# vi /etc/systemd/system/hadoop_jdk_profile [root@localhost sofware]# vi .bash_profile [root@localhost sofware]# sudo vim /etc/profile.d/my_env.sh export JAVA_HOME=/opt/module/jdk_1.8.0_321 export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin -------------------------------------------------------------------------- #JAVA_HOME export JAVA_HOME=/opt/module/jdk1.8.0_212 export PATH=$PATH:$JAVA_HOME/bin

5、source 一下/etc/profile 文件,讓新的環(huán)境變量 PATH 生效

[root@localhost~ ]# source /etc/systemd/system/hadoop_jdk_profile [root@localhost~ ]# source /opt/module/hadoop_jdk_profile

6、測試JDK是否安裝成功

[root@localhost~ ]# javac ?[root@localhost~ ]# java -version //注意:如果能看到結(jié)果,則代表 Java 安裝成功。 重啟(如果 java -version 可以用就不用重啟) [root@localhost~ ] reboot //重啟電腦

7、卸載jdk

卸載虛擬機自帶的 JDK 注意:如果你的虛擬機是最小化安裝不需要執(zhí)行這一步。 [root@hadoop100 ~]# rpm -qa | grep -i java | xargs -n1 rpm -e ?/*--nodeps --rpm -qa:查詢所安裝的所有 rpm 軟件包 --grep -i:忽略大小寫 --xargs -n1:表示每次只傳遞一個參數(shù) --rpm -e –nodeps:強制卸載軟件 */

8、jdk安裝遇到的問題

#centos7下javac:未找到命令的問題: #執(zhí)行安裝 yum install java-devel,yum install java #javac 或者 java -version Vi編輯常用快捷鍵 復制:ctrl+insert 粘貼:shift+insert 按Esc保存退出編譯,shift+zz退出.

三、hadoop安裝

1、Hadoop 下載

1) https://archive.apache.org/dist/hadoop/ 2) https://archive.apache.org/dist/hadoop/common/hadoop-3.1.3/

2、用 xftp傳輸工具將hadoop-3.1.3.tar.gz 導入到opt目錄下面的yuan文件夾

/opt/yuan/hadoop-3.1.3.tar.gz [root@localhost ~ ]# ls /opt/ yuan

3、解壓安裝文件到/opt/module

[root@localhost ~ ]# tar -zxvf /opt/yuan/hadoop-3.1.3.tar.gz -C /opt/module // 查看是否解壓成功 [root@localhost ~ ]# ls /opt/module/

4、hadoop環(huán)境配置

#根據(jù)文件路徑打開 vi /etc/systemd/system/hadoop_jdk_profile文件

#HADOOP_HOME export HADOOP_HOME=/opt/module/hadoop-3.1.3 export PATH=$PATH:$HADOOP_HOME/bin export PATH=$PATH:$HADOOP_HOME/sbin

5、修改后的文件重新生效

[root@localhost~ ]# source /etc/systemd/system/hadoop_jdk_profile

6、測試是否安裝成功

[root@localhost hadoop-3.1.3 ]# hadoop version Hadoop 3.1.3

7、重啟(如果 Hadoop命令不能用再重啟虛擬機)

[root@localhost hadoop-3.1.3 ]# sudo reboot

四、nginx安裝

1、下載nginx,zlib、openssl、pcre

1) http://nginx.org/en/download.html 2) http://sourceforge.net/projects/pcre/files/pcre/ 3) http://www.zlib.net/fossils/ 4) https://www.openssl.org/ 4) http://ftp.gnu.org/gnu/gcc/gcc-5.1.0/ # c編譯器 yum -y install gcc gcc-c++ autoconf automake make # 解析正則的pcre庫 yum install -y pcre pcre-devel # 添加對gzip的支持 yum install -y zlib zlib-devel # SSL yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel 依賴包安裝順序依次為:openssl、zlib、pcre, 最后安裝Nginx包。 #Nginx包 wget http://nginx.org/download/nginx-1.16.1.tar.gz #查文件的路徑位置 whereis openssl

2、解壓Nginx依賴包

tar -zxvf /opt/yuan/openssl-3.0.3.tar.gz-C /opt/module tar -zxvf /opt/yuan/zlib-1.2.12.tar.gz -C /opt/module tar -zxvf /opt/yuan/pcre2-10.40.tar.gz -C /opt/module tar -zxvf /opt/yuan/nginx-1.21.6.tar.gz -C /opt/module

3、進入解壓后的opt/module/nginx-1.21.6,執(zhí)行./configure

# openssl、zlib、pcre, Nginx包,解壓文件后進入對應的文件目錄執(zhí)行./configure完成后, 回到pcre ?openssl、zlib、pcre、 Nginx目錄下執(zhí)行make,在執(zhí)行make install [root@localhost openssl-3.0.3]# ./configure [root@localhost zlib-1.2.12]# ./configure [root@localhost pcre2-10.40]# ./configure [root@localhost nginx-1.21.6]# ./configure #如果執(zhí)行./configure沒有執(zhí)行,給./configure根據(jù)文件路徑配置 --prefix=/usr/local/nginx ?#路徑修改個人路徑 --with-http_ssl_module ?--with-pcre=../pcre-8.42 --with-zlib=../zlib-1.2.11 ?--with-openssl=../openssl-1.1.0h

4、Nginx的使用make && make install的區(qū)別

#./configure 配置環(huán)境 # make 是編譯。就是把源碼包編譯成二進制可執(zhí)行文件 # make install 安裝。 # make && make install 的意思是: # make 與 make install 是兩個命令,在 ./configuration 生成了Makefile之后執(zhí)行編譯安裝; # 與:&& 一起的還有||,&&是與,||是或; # make && make install 的意思就是在執(zhí)行完 make 后,如果沒有發(fā)生錯誤就執(zhí)行make install 。 [root@localhost openssl-3.0.3]# make && make install [root@localhost zlib-1.2.12]# make && make install [root@localhost pcre2-10.40]# make && make install [root@localhost nginx-1.21.6]# make && make install [root@localhost nginx-1.21.6]# make && make install

5、啟動Nginx(直接用默認配置啟動測試即可)

[root@localhost nginx-1.21.6]# cd /usr/local/nginx/sbin [root@localhost sbin]# ./nginx

6、開放端口

#開放nginx默認使用的80端口,并重啟防火墻 # 開放80端口 [root@localhost nginx-1.21.6]# firewall-cmd --zone=public --add-port=80/tcp --permanent # 立即生效 [root@localhost nginx-1.21.6]# firewall-cmd --reload #查看開放的端口號 [root@localhost nginx-1.21.6]# firewall-cmd --list-all #設置開放的端口號 [root@localhost nginx-1.21.6]# firewall-cmd --add-service=http –permanent [root@localhost nginx-1.21.6]# sudo firewall-cmd --add-port=80/tcp --permanent #重啟防火墻 [root@localhost nginx-1.21.6]# firewall-cmd –reload

7、設置nginx開機自啟

/etc/systemd/system/hadoop_jdk_profile目錄創(chuàng)建一個啟動腳本

[root@localhost~ ]# vi /etc/systemd/system/nginx.service -----------------------------第1種添加方式---------------------------------------------- #對服務的說明 [Unit] #描述服務 Description=nginx - high performance web server #描述服務類別 After=network.target remote-fs.target nss-lookup.target #服務的一些具體運行參數(shù)的設置 [Service] #后臺運行的形式 Type=forking #PID文件的路徑 PIDFile=/home/Software/Nginx/nginx-1.19.8/logs/nginx.pid #啟動準備 ExecStartPre=/home/Software/Nginx/nginx-1.19.8/sbin/nginx -t -c /home/Software/Nginx/nginx-1.19.8/conf/nginx.conf #啟動命令 ExecStart=/home/Software/Nginx/nginx-1.19.8/sbin/nginx -c /home/Software/Nginx/nginx-1.19.8/conf/nginx.conf #重啟命令 ExecReload=/home/Software/Nginx/nginx-1.19.8/sbin/nginx -s reload #停止命令 ExecStop=/home/Software/Nginx/nginx-1.19.8/sbin/nginx -s stop #給服務分配臨時空間 PrivateTmp=true [Install] #服務用戶的模式 WantedBy=multi-user.target -----------------------------------------------------第2種形式--------------------------------------------------- [Unit] #描述服務 Description=nginx service #描述服務類別 After=network.target remote-fs.target nss-lookup.target #服務的一些具體運行參數(shù)的設置 [Service] #后臺運行的形式 Type=forking #啟動準備 ExecStart=/usr/local/nginx/sbin/nginx #重啟命令 ExecReload=/usr/local/nginx/sbin/nginx -s reload #停止命令 ExecStop=/usr/local/nginx/sbin/nginx -s quit #給服務分配臨時空間 PrivateTmp=true [Install] WantedBy=multi-user.target

8、常用命令驗證

#設置開機自啟 systemctl enable nginx.service ?[root@localhost sbin]# systemctl enable nginx.service ?#停止開機自動啟動 systemctl disable nginx.service [root@localhost sbin]# systemctl disable nginx.service #查看狀態(tài) systemctl status nginx.service [root@localhost sbin]# systemctl status nginx.service #重新加載配置文件 systemctl reload nginx.service [root@localhost sbin]# systemctl reload nginx.service #重啟服務 systemctl restart nginx.service [root@localhost sbin]# systemctl restart nginx.service ----------------------------------------第2種方式---------------------------------------------- 1.重啟命令 在/usr/local/nginx/sbin目錄下執(zhí)行./nginx 2.關閉命令 在/usr/local/nginx/sbin目錄執(zhí)行./nginx-S stop 3.重新加載命令 在/usr/local/nginx/sbin目錄下執(zhí)行./nginx-s reload

五、Tomcat 安裝

1)Tomcat下載

https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.22/bin/

2、使用xftp將下載好的apache-tomcat-9.0.22.tar.gz,上傳的Linux中的opt/yuan

/opt/yuan/apache-tomcat-9.0.22.tar.gz

3、解壓縮包

[root@localhost /]# tar -zxvf /opt/yuan/apache-tomcat-9.0.22.tar.gz -C /opt/module

4、啟動服務

[root@localhost /]# cd /opt/module/apache-tomcat-9.0.22/bin [root@localhost bin]# ./startup.sh

5、檢查是否有tomcat進程

[root@localhost /]# cd /opt/module/apache-tomcat-9.0.22/bin [root@host-192-168-0-153 bin]# ./startup.sh

6、查詢端口是否有進程守護,如8080為端口號

[root@localhost bin]# netstat -an | grep 8080 -bash: netstat: 未找到命令 [root@localhost ~]# yum -y install net-tools ? <!--安裝依賴程序--> [root@localhost bin]# netstat -an | grep 8080

7、tomcat配置文件

------------------------------------------------------------------------------- 配置文件 cd /usr/lib/systemd/system [root@localhost ~]# vi /etc/systemd/system/hadoop_jdk_profile [Unit] Description=Tomcat After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=oneshot ExecStart=/opt/module/apache-tomcat-9.0.22/bin/startup.sh ExecStop=/opt/module/apache-tomcat-9.0.22/bin/shutdown.sh ExecReload=/bin/kill -s HUP $MAINPID RemainAfterExit=yes [Install] WantedBy=multi-user.targe -------------------------------------------------------------------------- #tomcat環(huán)境變量目錄 #JAVA_HOME export JAVA_HOME=/opt/module/jdk1.8.0_212 export PATH=$PATH:$JAVA_HOME/bin CATALINA_HOME=/opt/module/apache-tomcat-9.0.22 PATH=$PATH:$CATALINA_HOME/bin export PATH JAVA_HOME CLASSPATH CATALINA_HOME

8、重新啟動tomcat的文件屬性,把tomcat 修改為可運行的文件

[root@localhost~ ]# source /etc/systemd/system/hadoop_jdk_profile [root@localhost~ ]# chmod a+x /etc/systemd/system/hadoop_jdk_profile

9、設置服務運行級別(配置開機自啟)---嘗試

[root@host-192-168-0-153 bin]# chkconfig --add tomcat9 [root@localhost bin]# ./startup.sh /*報錯異常 Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this program 解決方法如下:*/ ?2)啟動服務器的tomcat失敗 [root@localhost bin]# find / -name setclasspath.sh ?/opt/module/apache-tomcat-9.0.22/bin/setclasspath.s #如果不清楚setclasspath.sh文件位置,可以使用find命令或者locate命令搜索 find / -name setclasspath.sh //然后使用vi或vim命令打開setclasspath.sh文件進行修改 [root@localhost bin]# /opt/module/apache-tomcat-9.0.22/bin/vi setclasspath.sh 3)在setclasspath.sh文件的開頭部分添加JAVA_HOME和JRE_HOME的環(huán)境變量路徑。如下: //注意,可能我們并不知道JAVA_HOME和JRE_HOME環(huán)境變量的值,可以通過如下命令查看 echo $JAVA_HOME echo $JRE_HOME //然后把結(jié)果添加倒setclasspath.sh文件的開頭部分,注意這里的/jdk和/jdk/jre是我主機上通過echo JAVA_HOME等命令查詢出來的結(jié)果,具體值還得看自己服務器上的安裝路徑. export JAVA_HOME=/opt/module/jdk1.8.0_212 export JRE_HOME=/opt/module/jdk1.8.0_212/jre //再重啟tomcat [root@localhost bin]# vi setclasspath.sh

10、修改tomcat默認端口,進入conf目錄,編輯server.xml

//修改8080端口為你需要的端口,默認8080端口并不安全 <Connector executor="tomcatThreadPool" ? ? ? ? ? ? ? ?port="8080" protocol="HTTP/1.1" ? ? ? ? ? ? ? ?connectionTimeout="20000" ? ? ? ? ? ? ? ?redirectPort="8443" />

11、啟動Tomcat服務

// ? ?./catalina.sh start 和 ?./startup.sh ? 都能啟動tomcat。 // ? ? ./catalina.sh stop ?或 ?./shutdown.sh ?停止tomcat。 //進入apache-tomcat-9.0.22 /bin目錄 [root@localhost bin]# ./startup.sh

12、關閉Tomcat服務

//進入apache-tomcat-9.0.22 /bin目錄 [root@localhost bin]# ./shutdown.sh

13、驗證tomcat安裝成功

//查看Tomcat啟動是否正常 安裝lsof命令: [root@localhost bin]# yum install -y lsof 驗證命令: [root@localhost bin]# lsof -i:8080 //查詢tomcat命令: [root@localhost bin]# ps -ef|grep tomcat ?//查看日志 [root@localhost bin]# cd /opt/module/apache-tomcat-9.0.22/logs //殺死進程 [root@localhost bin]# ?kill -9 pid


docker 安裝-jdk安裝-hadoop安裝-nginx安裝-tomcat安裝的評論 (共 條)

分享到微博請遵守國家法律
西昌市| 图们市| 云浮市| 保山市| 邢台县| 彩票| 曲阜市| 民勤县| 景泰县| 淳安县| 石台县| 噶尔县| 法库县| 子长县| 开平市| 清水县| 长武县| 淮北市| 洪洞县| 弋阳县| 兴化市| 延津县| 宜良县| 乐安县| 万安县| 黎城县| 高淳县| 扶绥县| 天镇县| 和平区| 沁阳市| 巫山县| 靖西县| 青田县| 扬中市| 咸丰县| 鄂托克旗| 云南省| 郴州市| 光山县| 灌南县|