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

Does centos come with its own server?

Jul 29, 2020 am 10:14 AM
centos server

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

Does centos come with its own server?

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

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

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

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

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

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

创建常用目录

sudo mkdir /data
sudo chown -R oper data
cd /data
mkdir apps
Copy after login

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;
Copy after login

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
Copy after login

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
Copy after login

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里面
Copy after login

6. 安装nginx

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

相关教程推荐: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 of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1252
24
What are the backup methods for GitLab on CentOS What are the backup methods for GitLab on CentOS Apr 14, 2025 pm 05:33 PM

Backup and Recovery Policy of GitLab under CentOS System In order to ensure data security and recoverability, GitLab on CentOS provides a variety of backup methods. This article will introduce several common backup methods, configuration parameters and recovery processes in detail to help you establish a complete GitLab backup and recovery strategy. 1. Manual backup Use the gitlab-rakegitlab:backup:create command to execute manual backup. This command backs up key information such as GitLab repository, database, users, user groups, keys, and permissions. The default backup file is stored in the /var/opt/gitlab/backups directory. You can modify /etc/gitlab

Centos shutdown command line Centos shutdown command line Apr 14, 2025 pm 09:12 PM

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.

Difference between centos and ubuntu Difference between centos and ubuntu Apr 14, 2025 pm 09:09 PM

The key differences between CentOS and Ubuntu are: origin (CentOS originates from Red Hat, for enterprises; Ubuntu originates from Debian, for individuals), package management (CentOS uses yum, focusing on stability; Ubuntu uses apt, for high update frequency), support cycle (CentOS provides 10 years of support, Ubuntu provides 5 years of LTS support), community support (CentOS focuses on stability, Ubuntu provides a wide range of tutorials and documents), uses (CentOS is biased towards servers, Ubuntu is suitable for servers and desktops), other differences include installation simplicity (CentOS is thin)

How to optimize CentOS HDFS configuration How to optimize CentOS HDFS configuration Apr 14, 2025 pm 07:15 PM

Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

Centos configuration IP address Centos configuration IP address Apr 14, 2025 pm 09:06 PM

Steps to configure IP address in CentOS: View the current network configuration: ip addr Edit the network configuration file: sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 Change IP address: Edit IPADDR= Line changes the subnet mask and gateway (optional): Edit NETMASK= and GATEWAY= Lines Restart the network service: sudo systemctl restart network verification IP address: ip addr

What are the common misunderstandings in CentOS HDFS configuration? What are the common misunderstandings in CentOS HDFS configuration? Apr 14, 2025 pm 07:12 PM

Common problems and solutions for Hadoop Distributed File System (HDFS) configuration under CentOS When building a HadoopHDFS cluster on CentOS, some common misconfigurations may lead to performance degradation, data loss and even the cluster cannot start. This article summarizes these common problems and their solutions to help you avoid these pitfalls and ensure the stability and efficient operation of your HDFS cluster. Rack-aware configuration error: Problem: Rack-aware information is not configured correctly, resulting in uneven distribution of data block replicas and increasing network load. Solution: Double check the rack-aware configuration in the hdfs-site.xml file and use hdfsdfsadmin-printTopo

What steps are required to configure CentOS in HDFS What steps are required to configure CentOS in HDFS Apr 14, 2025 pm 06:42 PM

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

Centos stops maintenance 2024 Centos stops maintenance 2024 Apr 14, 2025 pm 08:39 PM

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

See all articles