Home  >  Article  >  Operation and Maintenance  >  Does centos come with its own server?

Does centos come with its own server?

coldplay.xixi
coldplay.xixiOriginal
2020-07-29 10:14:392389browse

centos不是自带服务器的,安装方法:首先在root操作下新增oper用户;然后将oper用户加入到sudoers中;接着切换到oper重新登录;最后创建常用目录即可。

Does centos come with its own server?

centos不是自带服务器的,安装方法:

1. 新增oper用户(root下操作)

useradd oper
# 修改密码:根据提示输入两次密码
passwd oper

将oper用户加入到sudoers中(可使用sudo命令)

vi /etc/sudoers
# 找到类似地方并加入
oper    ALL=(ALL)       ALL

切换到oper重新登录(重要)

创建常用目录

sudo mkdir /data
sudo chown -R oper data
cd /data
mkdir apps

2. 安装数据库mysql5.7

# Step0:安装所需的yum命令
sudo yum -y install yum-utils
# Step1: 检测系统是否自带安装mysql
sudo yum list installed | grep mysql
# Step2: 删除系统自带的mysql及其依赖命令:
sudo yum -y remove mysql-libs.x86_64
# Step3: 给CentOS添加rpm源,并且选择较新的源命令:
wget dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
sudo yum localinstall mysql-community-release-el7-5.noarch.rpm
sudo yum repolist all | grep mysql
sudo yum-config-manager --disable mysql55-community
sudo yum-config-manager --disable mysql56-community
sudo yum-config-manager --enable mysql57-community-dmr
sudo yum repolist enabled | grep mysql
# Step4:安装mysql 服务器命令:
sudo yum install mysql-community-server
# Step5: 启动mysql命令:
service mysqld start
# Step6: 查看mysql是否自启动,并且设置开启自启动命令:
chkconfig --list | grep mysqld
chkconfig mysqld on
# Step7: mysql安全设置命令:
# 获取root临时密码
grep 'temporary password' /var/log/mysqld.log
# 修改root密码
mysql_secure_installation
# 根据提示修改root密码 ...
# 登录命令(根据提示输入root密码登录):
mysql -u root -p 
# 创建数据库:
create database clouds_business;
创建用户:
create user yunch identified by 'Yunch!2#$5^';
# 授权数据库给用户
grant all on clouds_business.* to yunch;

3. 安装jdk1.8

# 1、在Oracle官方网址下载linux-64位的jdk的RPM包,如:jdk-8u121-linux-x64.rpm
# 2、使用SFTP工具将jar包上传至 /data/apps目录下
# 3、执行上传的rpm文件,如:rpm -ivh jdk-8u***-linux-x64.rpm 
# 4、配置环境变量(下面代码中版本根据实际情况调整)
vi /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_191-amd64
JRE_HOME=/usr/java/jdk1.8.0_191-amd64/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
# 退出vi,使环境变量生效
source /etc/profile

4. 安装zookeeper

# 下载zookeeper安装包(建议3.4及以下版本)
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
# 解压
tar -xvf zookeeper-3.4.14.tar.gz
rm -f *.gz
cd zookeeper-3.4.14
cd conf
# 将sample配置文件重命名成正式文件
mv zoo_sample.cfg zoo.cfg
# 启动zookeeper
../bin/zkServer.sh start
# 执行lsof命令观察
lsof -i 2181

5. 安装redis

wget http://download.redis.io/redis-stable.tar.gz
tar -xvf ...
mv redis-stable redis
cd redis
vi redis.conf
# 修改密码和端口号
sudo make && sudo make install
# 运行redis 
nohup redis-server redis.conf &
# 日志在 nohup.out里面

6. 安装nginx

sudo yum -y install nginx
# 修改权限 
sudo chown -R oper /etc/nginx
# 修改/etc/nginx/nginx.conf配置
#在 conf.d里面增加.conf文件
# 重启命令
sudo nginx -s reload

相关教程推荐:centos教程

The above is the detailed content of Does centos come with its own server?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn