用于大数据开发的Centos7操作系统安装过程中遇到的问题总结
1.1 操作系統
機器域名 機器別名
xxx.xxx.xxx.xxx bigdata1 xxx.xxx.xxx.xxx bigdata2 xxx.xxx.xxx.xxx bigdata33臺機器用戶名和密碼:
用戶名 密碼
1.1.1 裝機注意事項
一、 U盤安裝的時候報錯的解決方案
參考解決問題的網址:https://www.cnblogs.com/freeweb/p/5213877.html /dev/sda /dev/sda4 /dev/sdb /dev/sdb1~3將 vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet 更改為(即更改inst.stage2=hd:后面的內容即可) vmlinuz initrd=initrd.img inst.stage2=hd:/dev/sda4:/ quiet二、修改/etc/resolv.conf,將配置中的值改成
nameserver 202.xxx.xxx.xx 前面兩個要和測試服務器上的這兩個nameserver保持一致 nameserver 202.xxx.xxx.xx 這兩個用于聯網使用 nameserver 8.8.8.8 下面這兩個必須有,否則在使用yum的時候使用不了 nameserver 8.8.4.4三、修改/etc/sysconfig/network-scprits/ifcfg-*,內容如下:
TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="static" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="enp3s0" UUID="xxxxxxxxxxxxxxxxxxxxxxxx" DEVICE="enp3s0" ONBOOT="yes" IPADDR="xxx.xxx.xxx.xxx" IPADDR1="xxx.xxx.xxx.xxx" #這里是虛擬ip PREFIX="24" GATEWAY="xxx.xxx.xxx.xxx" IPV6_PRIVACY="no" DNS1=xxx.xxx.xxx.xxx DNS2=xxx.xxx.xxx.xxx DNS3=8.8.8.8 DNS4=8.8.4.4修改完成之后,執行重啟網絡配置命令:
service network restart四、修改hosts,hostname.效果如下:
[root@bigdata3 ~]# cat /etc/hosts (3臺服務器的這個配置一致) #127.0.0.1 localhost localhost.localdo:wqmain localhost4 localhost4.localdomain4 #::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 xxx.xxx.xxx.xxx bigdata1 xxx.xxx.xxx.xxx bigdata2 xxx.xxx.xxx.xxx bigdata3 [root@bigdata3 ~]# [root@bigdata1 ~]# cat /etc/hostname bigdata1 [root@bigdata2 ~]# cat /etc/hostname bigdata2 [root@bigdata3 ~]# cat /etc/hostname bigdata3五、為了讓服務能夠被遠程工具連接,配置/etc/ssh/sshd_config中監聽的端口和ip地址
Port 22 這里可以不放開,默認是22端口 PermitRootLogin yes PasswordAuthentication yeshttp://blog.csdn.net/tuntun1120/article/details/65443757即:將/etc/ssh下的sshd_config文件中的,關于監聽端口、監聽地址前的#號去除。
六、centos yum報錯Loaded plugins: fastestmirror
解決辦法參考:http://blog.csdn.net/zvall/article/details/52180699vim /etc/yum/pluginconf.d/fastestmirror.conf enabled = 0vim /etc/yum.conf plugins=0yum clean dbcache如果發現還是不可以使用yum命令安裝各種軟件,這時候說明是DNS的配置有問題
解決辦法是:
A:修改vim /etc/sysconfig/network-scripts/ifcfg-eth
添加如下內容:
上面的dns名稱不能重復
同時在/etc/resolv.conf中添加:
nameserver 8.8.8.8 nameserver 8.8.4.4然后重啟項目即可
六、安裝wget
yum –y install wget七、更新安裝vim,安裝vim增強包
yum –y install vim-enhanced八、解決netstat:command not found問題
yum install net-tools九、Centos7防火墻配置:
http://blog.csdn.net/lukaixiao/article/details/53946243將默認Firewall改為iptables防火墻
關閉firewall: service network restart #重啟網絡systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止Firewall開啟啟動firewall-cmd –state #查看默認防火墻狀態(關閉后顯示notrunning,開啟后顯示running)配置iptable防火墻
vi /etc/sysconfig/iptables #編輯防火墻配置文件# sampleconfiguration for iptables service # you can edit thismanually or use system-config-firewall # please do not askus to add additional ports/services to this default configuration *filter <!-- 本行請查看下面備注--> :INPUT ACCEPT [0:0] :FORWARD ACCEPT[0:0] :OUTPUT ACCEPT[0:0] -A INPUT -m state--state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -jACCEPT -A INPUT -i lo -jACCEPT -A INPUT -p tcp -mstate --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -jACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 8080-j ACCEPT -A INPUT -j REJECT--reject-with icmp-host-prohibited -A FORWARD -jREJECT --reject-with icmp-host-prohibited COMMIT:wq! #保存退出
備注:這里使用80和8080端口為例
filter
以上部分一般添加到下行的上面或者下面
切記不要添加到最后一行,否則防火墻重啟后不生效
systemctl restart iptables.service #最后重啟防火墻使配置生效 systemctl enable iptables.service #設置防火墻開機啟動它防火墻參數配置:
其修改防火墻配置文件之前,需要對之前防火墻做好備份
重啟防火墻后,需要確認防火墻狀態和防火墻規則是否加載,若重啟失敗或規則加載失敗,則所有請求都會被防火墻
2、關閉firewall:
systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall開機啟動 firewall-cmd --state #查看默認防火墻狀態(關閉后顯示notrunning,開啟后顯示running)1、firewalld的基本使用
啟動: systemctl start firewalld 查看狀態: systemctl status firewalld 停止: systemctl disable firewalld 禁用: systemctl stop firewalld2.systemctl是CentOS7的服務管理工具中主要的工具,它融合之前service和chkconfig的功能于一體。
啟動一個服務:systemctl start firewalld.service 關閉一個服務:systemctl stop firewalld.service 重啟一個服務:systemctl restart firewalld.service 顯示一個服務的狀態:systemctl status firewalld.service 在開機時啟用一個服務:systemctl enable firewalld.service 在開機時禁用一個服務:systemctl disable firewalld.service 查看服務是否開機啟動:systemctl is-enabled firewalld.service 查看已啟動的服務列表:systemctl list-unit-files|grep enabled 查看啟動失敗的服務列表:systemctl --failed3.配置firewalld-cmd
查看版本: firewall-cmd --version 查看幫助: firewall-cmd --help 顯示狀態: firewall-cmd --state 查看所有打開的端口: firewall-cmd --zone=public --list-ports 更新防火墻規則: firewall-cmd --reload 查看區域信息: firewall-cmd --get-active-zones 查看指定接口所屬區域: firewall-cmd --get-zone-of-interface=eth0 拒絕所有包:firewall-cmd --panic-on 取消拒絕狀態: firewall-cmd --panic-off 查看是否拒絕: firewall-cmd --query-panic那怎么開啟一個端口呢
添加
重新載入
firewall-cmd --reload查看
firewall-cmd --zone= public --query-port=80/tcp刪除
firewall-cmd --zone= public --remove-port=80/tcp --permanent因為在/usr/lib/firewalld/services/中事先定義了ssh.xml的相應的規則
十、關閉selinux
關閉selinux:https://www.linuxidc.com/Linux/2016-11/137723.htm
十一、關閉使用交換空間
編輯/etc/sysctl.conf,改vm.overcommit_memory=0,然后sysctl -p 使配置文件生效關于參數說明,參考:https://blog.csdn.net/whycold/article/details/21388455
十二:添加iptables
安裝iptables
iptables其它命令:
#編輯防火墻文件 (建議都在配置文件配置,不要命令配置) vi /etc/sysconfig/iptables #添加80和3306端口 等等(自己配置) -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT #80端口開放 -A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT #3306端口開放 -I INPUT -s 113.106.93.110 -p tcp --dport 8089 -j DROP #禁止指定IP訪問 8089 -I INPUT -s 113.106.93.110 -p tcp --dport 8080 -j ACCEPT #開放固定ipIP訪問 8080#重啟防火墻使配置文件生效 systemctl restart iptables.service #設置iptables防火墻為開機啟動項 systemctl enable iptables.serviceservice iptables start #啟動服務 service iptables stop #停止服務 service iptables restart #重啟服務在設置iptable之后,需要執行以下命令 [root@localhost sbin]# service iptables save [root@localhost sbin]# service iptables restart以下案例是將192.168.18.141機器上的9095端口映射到192.168.18.145上9095端口 iptables -t nat -A PREROUTING -d 192.168.18.141 -p tcp -m tcp --dport 9095 -j DNAT --to-destination 192.168.18.145:9095Iptable其它知識點:
1、安裝iptable iptable-service #先檢查是否安裝了iptables service iptables status #安裝iptables yum install -y iptables #升級iptables(安裝的最新版本則不需要) yum update iptables #安裝iptables-services yum install iptables-services 2、禁用/停止自帶的firewalld服務 #停止firewalld服務 systemctl stop firewalld #禁用firewalld服務 systemctl mask firewalld 3、設置現有規則 #查看iptables現有規則 iptables -L -n #先允許所有,不然有可能會杯具 iptables -P INPUT ACCEPT #清空所有默認規則 iptables -F #清空所有自定義規則 iptables -X #所有計數器歸0 iptables -Z #允許來自于lo接口的數據包(本地訪問) iptables -A INPUT -i lo -j ACCEPT #開放22端口 iptables -A INPUT -p tcp --dport 22 -j ACCEPT #開放21端口(FTP) iptables -A INPUT -p tcp --dport 21 -j ACCEPT #開放80端口(HTTP) iptables -A INPUT -p tcp --dport 80 -j ACCEPT #開放443端口(HTTPS) iptables -A INPUT -p tcp --dport 443 -j ACCEPT #允許ping iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT #允許接受本機請求之后的返回數據 RELATED,是為FTP設置的 iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT #其他入站一律丟棄 iptables -P INPUT DROP #所有出站一律綠燈 iptables -P OUTPUT ACCEPT #所有轉發一律丟棄 iptables -P FORWARD DROP4、其他規則設定 #如果要添加內網ip信任(接受其所有TCP請求) iptables -A INPUT -p tcp -s 45.96.174.68 -j ACCEPT #過濾所有非以上規則的請求 iptables -P INPUT DROP #要封停一個IP,使用下面這條命令: iptables -I INPUT -s ***.***.***.*** -j DROP #要解封一個IP,使用下面這條命令: iptables -D INPUT -s ***.***.***.*** -j DROP5、保存規則設定 #保存上述規則 service iptables save6、開啟iptables服務 #注冊iptables服務 #相當于以前的chkconfig iptables on systemctl enable iptables.service #開啟服務 systemctl start iptables.service #查看狀態 systemctl status iptables.service 7、映射端口(如將mysql默認的3306端口映射成1306對外提供服務) iptables -t mangle -I PREROUTING -p tcp --dport 1306 -j MARK --set-mark 883306 iptables -t nat -I PREROUTING -p tcp --dport 1306 -j REDIRECT --to-ports 3306 iptables -I INPUT -p tcp --dport 3306 -m mark --mark 883306 -j ACCEPT十三 brctl命令管理網橋
安裝brctl命令包
我們創建了網橋之后如何刪除呢?若要想將這個網橋上的port卸下來。
brctl show #查看網橋狀態 brctl delif <網橋名> <端口名> #卸載網橋上的端口 ifconfig #查看是否有網橋網卡名 ifconfig <網橋名> down #關閉此網卡 brctl delbr <網橋名> #刪除網橋1.2 下載軟件
軟件清單:
jdk-8u73-linux-x64.tar.gz Java JDK1.8+環境 apache-maven-3.3.9-bin.tar.gz Maven安裝文件 apache-tomcat-8.5.12.tar.gz Tomcat安裝包 MySQL-5.7.21-linux-glibc2.12-x86_64.tar.gz MySQL5.7zookeeper-3.4.11.tar.gz Zookeeper安裝軟件 hadoop-3.0.0.tar.gz Hadoop安裝軟件apache-hive-2.3.2-bin.tar.gz 數據倉庫之hive apache-flume-1.8.0-bin.tar.gz 日志收集框架二進制 sqoop-1.4.7.tar.gz 關系型數據庫和hdfs數據之間轉換的工具apache-storm-1.2.1.tar.gz 實時數據處理之storm安裝包 azkaban-master-source.zip 任務調度所需的源碼包spark-2.3.0-bin-hadoop2.7.tgz Spark之針對hadoop2.7版本的安裝包 scala-2.13.0-M3.zip Spark編寫所需的scala語言包 hbase-1.4.2-bin.tar.gz Hbase安裝包elasticsearch-6.2.2.rpm ES之Linux rpm安裝包 elasticsearch-6.2.2.tar.gz ES值Linux tar安裝包 logstash-6.2.2.rpm ELK之logstash日志收集框架 logstash-6.2.2.tar.gz ELK之logstash日志收集框架tar包 kibana-6.2.2-linux-x86_64.tar.gz ELK套件之視圖展示用框架 kibana-6.2.2-x86_64.rpm ELK套件之視圖展示用框架rpm安裝包redis-3.2.9.tar.gz redis安裝包 kylin Apache Kylin?是一個開源的分布式分析引擎,提供Hadoop/Spark之上的SQL查詢接口及多維分析(OLAP)能力以支持超大規模數據 presto Presto是一個開源的分布式SQL查詢引擎,適用于交互式分析查詢,數據量支持GB到PB字節.Presto的設計和編寫完全是為了解決像Facebook這樣規模的商業數據倉庫的交互式分析和處理速度的問題1.3 上傳安裝包
將安裝文件上傳到:/home/bigdata/software
1.4 3臺服務器間的免密登錄
在bigdata1、bigdata2、bigdata3下執行:
ssh-keygen -t rsa (這個過程中一致打enter) ssh-copy-id bigdata1 ssh-copy-id bigdata2 ssh-copy-id bigdata3執行完成上面的命令之后,分別bigdata1、bigdata2、bigdata3上執行:
ssh bigdata1 ssh bigdata2 ssh bigdata3按照如果最后能夠免密碼登錄進去,說明免密登錄成功
1.5 搭建ntp時間服務器
讓Linux上的時間和網絡時間保持一致,避免一些時間不一致的問題(必須在root命令下執行)
[root@bigdata1 ~]# yum install -y ntp [root@bigdata1 ~]# ntpdate pool.ntp.org && hwclock -w1.5.1 Ntp時間同步的另外一種搭建方式
1)安裝NTP(每個節點)
yum install ntp
2)配置NTP
vim /etc/ntp.conf
master配置:(選用復旦大學ntp服務器)
slave配置:(同步master)
3)開啟NTP服務
service ntpd start
chkconfig ntpd on
4)查看同步效果
命令:ntpstat
1.6 常見命令
查看常見命令
查看機器上運行端口
查看某個端口運行在哪個位置
ps –ef | grep PID (PID即上面netstat –tunlp中查看出來的PID)centos7下查看哪些端口開放了
firewall-cmd –list-ports防火墻開放端口:
firewall-cmd --zone=public --add-port=80/tcp –permanent命令含義:
–zone #作用域 –add-port=80/tcp #添加端口,格式為:端口/通訊協議 –permanent #永久生效,沒有此參數重啟后失效firewall-cmd --reload #重啟firewall systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall開機啟動通過iptables的方式查看開放的端口:
/etc/init.d/iptables status查看某個文件夾下含有某個字符串的命令:
grep -rl 'mysqld' ./安裝telnet
[root@bigdata3 ~]# yum install net-tools總結
以上是生活随笔為你收集整理的用于大数据开发的Centos7操作系统安装过程中遇到的问题总结的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 乌鲁木齐斯贝斯酒吧消费高吗
- 下一篇: java信息管理系统总结_java实现科