search
HomeOperation and MaintenanceCentOSDoes centos come with its own server?

Does centos come with its own server?

Jul 29, 2020 am 10:14 AM
centosserver

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
Using CentOS: A Guide for System AdministratorsUsing CentOS: A Guide for System AdministratorsApr 22, 2025 am 12:04 AM

CentOS is an open source operating system based on RedHatEnterpriseLinux, suitable for server environments. 1. Select the appropriate media and options during installation and configure network, firewall and user permissions. 2. Use useradd, usermod and systemctl commands to manage users and services, and update software packages regularly. 3. Basic operations include using yum installation software and systemctl management services, and advanced features such as SELinux to enhance security. 4. Check the system log to solve common errors. Optimizing performance requires monitoring resources and cleaning of unnecessary files.

CentOS: Security, Stability, and PerformanceCentOS: Security, Stability, and PerformanceApr 21, 2025 am 12:11 AM

CentOS is the first choice for server and enterprise environments for its superior security, stability and performance. 1) Security provides forced access control through SELinux to improve system security. 2) Stability is supported by the LTS version for up to 10 years to ensure the stability of the system. 3) Performance significantly improves system response speed and resource utilization by optimizing kernel and system configuration.

The CentOS Replacement Landscape: Current Trends and ChoicesThe CentOS Replacement Landscape: Current Trends and ChoicesApr 20, 2025 am 12:05 AM

CentOS alternatives should have the characteristics of stability, compatibility, community support and package management. 1.AlmaLinux provides 10 years of support, 2. RockyLinux is initiated by the founder of CentOS to ensure compatibility with CentOS. Migration cost and performance optimization should be considered when choosing.

CentOS: An Introduction to the Linux DistributionCentOS: An Introduction to the Linux DistributionApr 19, 2025 am 12:07 AM

CentOS is an open source distribution based on RedHatEnterpriseLinux, focusing on stability and long-term support, suitable for a variety of server environments. 1. The design philosophy of CentOS is stable and suitable for web, database and application servers. 2. Use YUM as the package manager to release security updates regularly. 3. Simple installation, you can build a web server with a few commands. 4. Advanced features include enhanced security using SELinux. 5. Frequently asked questions such as network configuration and software dependencies can be debugged through nmcli and yumdeplist commands. 6. Performance optimization suggestions include tuning kernel parameters and using a lightweight web server.

CentOS in Action: Server Management and Web HostingCentOS in Action: Server Management and Web HostingApr 18, 2025 am 12:09 AM

CentOS is widely used in server management and web hosting. Specific methods include: 1) using yum and systemctl to manage the server, 2) install and configure Nginx for web hosting, 3) use top and mpstat to optimize performance, 4) correctly configure the firewall and manage disk space to avoid common problems.

CentOS: A Community-Driven Linux DistributionCentOS: A Community-Driven Linux DistributionApr 17, 2025 am 12:03 AM

CentOS is a stable, enterprise-grade Linux distribution suitable for server and enterprise environments. 1) It is based on RedHatEnterpriseLinux and provides a free, open source and compatible operating system. 2) CentOS uses the Yum package management system to simplify software installation and updates. 3) Support advanced automation management, such as using Ansible. 4) Common errors include package dependency and service startup issues, which can be solved through log files. 5) Performance optimization suggestions include the use of lightweight software, regular cleaning of the system and optimization of kernel parameters.

What Comes After CentOS: The Road AheadWhat Comes After CentOS: The Road AheadApr 16, 2025 am 12:07 AM

Alternatives to CentOS include RockyLinux, AlmaLinux, OracleLinux, and SLES. 1) RockyLinux and AlmaLinux provide RHEL-compatible binary packages and long-term support. 2) OracleLinux provides enterprise-level support and Ksplice technology. 3) SLES provides long-term support and stability, but commercial licensing may increase costs.

CentOS: Exploring the AlternativesCentOS: Exploring the AlternativesApr 15, 2025 am 12:03 AM

Alternatives to CentOS include UbuntuServer, Debian, Fedora, RockyLinux, and AlmaLinux. 1) UbuntuServer is suitable for basic operations, such as updating software packages and configuring the network. 2) Debian is suitable for advanced usage, such as using LXC to manage containers. 3) RockyLinux can optimize performance by adjusting kernel parameters.

See all articles

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 Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools