Centos7下环境搭建
CentOS更改yum源与更新系统
[1]首先备份/etc/yum.repos.d/CentOS-Base.repo
mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup
[2]进入yum源配置文件所在文件夹
[root@localhostyum.repos.d]# cd /etc/yum.repos.d/
[3]下载163的yum源配置文件,放入/etc/yum.repos.d/(操作前请做好相应备份)
[root@localhost
yum.repos.d]#wgethttp://mirrors.163.com/.help/CentOS6-Base-163.repo
[4]运行yum makecache生成缓存
[root@localhostyum.repos.d]# yum makecache
[5]更新系统
[root@localhostyum.repos.d]# yum -y update
[6]安装vim编辑器
[root@localhost
~]# yum -yinstallvim*
[6]安装ifconfig、telnet
yum install net-tools
yum install telnet
java jdk安装
1、新建文件夹
Make dir /usr/java
2、解压压缩包
3、配置环境变量
vi /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_25
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH
source /etc/profile
Python3安装
1、安装python3可能使用的依赖
yuminstall openssl-devel bzip2-devel expat-devel gdbm-devel readline-develsqlite-devel
2、下载python包,解压后,移动到/usr/local下
3、进入Python目录
执行:
./configure--prefix=/usr/local/python3
make && make install
4、创建新的软链接到最新的python
# ln-s /usr/local/python3/bin/python3 /usr/bin/python3
# ln-s /usr/local/python3/bin/pip3.6 /usr/bin/pip3
postgresql安装
1.添加RPM
yum installhttps://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
2.安装PostgreSQL9.5
yum install postgresql95-server postgresql95-contrib
3.初始化数据库
/usr/pgsql-9.5/bin/postgresql95-setup initdb
4.设置开机自启动
systemctl enable postgresql-9.5.service
5.启动服务
systemctl start postgresql-9.5.service
6.修改用户密码
su - postgres
psql -U postgres
ALTER USER postgres WITH PASSWORD 'abc123';
7.开启远程访问
vi /var/lib/pgsql/9.5/data/postgresql.conf
修改#listen_addresses = 'localhost'为listen_addresses='*'
8.信任远程连接
vi /var/lib/pgsql/9.5/data/pg_hba.conf
修改如下内容,信任指定服务器连接
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all0.0.0.0/32trust
9.打开防火墙
lsfirewall-cmd --add-service=postgresql --permanent开放服务
irewall-cmd --reload重载防火墙
10.重启PostgreSQL数据服务
systemctl restart
postgresql-9.5.service
redis安装
1、安装gcc和tcl
yum install gcc
yum install tcl
2、下载最新安装包
wget http://download.redis.io/redis-stable.tar.gz
tar zxvf
redis-stable.tar.gz
cd redis-stable
make &&
sudo make install
如果报错:
Make执行带参数:make MALLOC=libc
3.启动
redis-server redis.conf
nginx安装
1、安装依赖包
yum install gcc-c++
yum install -y pcrepcre-devel
yum install -y zlib
zlib-devel
yum install -yopenssl openssl-devel
2、下载nginx
Wgethttp://nginx.org/download/nginx-1.12.1.tar.gz
3、安装
tar xzvf nginx-1.12.1.tar.gz
cd nginx-1.10.1
./configure#使用默认配置
Make && make install
4、启动
cd/usr/local/nginx/sbin
./nginx#启动
./nginx -s stop
./nginx -s quit
./nginx -s reload
5、开机自启
即在rc.local增加启动代码就可以了。
vi /etc/rc.local
增加一行/usr/local/nginx/sbin/nginx
设置执行权限:
chmod755rc.local
kafka安装
1.下载安装包
2.解压
3.启动Zookeeper server
bin/zookeeper-server-start.sh config/zookeeper.properties &
4.启动Kafka server
bin/kafka-server-start.sh config/server.properties &
5.停止Kafka server
bin/kafka-server-stop.sh
6.停止Zookeeper server:
bin/zookeeper-server-stop.sh