Centos 安装配置

Posted pizhiyun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos 安装配置相关的知识,希望对你有一定的参考价值。

VirtualBox install CentOS

 

Centos7安装完毕后重启提示Initial setup of CentOS Linux 7 (core)的解决方法

问题:

CentOS7安装完毕,重新开机启动后显示:

Initial setup of CentOS Linux 7 (core)

1) [x] Creat user 2) [!] License information

(no user will be created) (license not accepted)

Please make your choice from above [‘q‘ to quit | ‘c‘ to continue | ‘r‘ to refresh]:

解决方法:

输入1”,按Enter

输入2”,按Enter

输入q",按Enter

输入yes”,按Enter

 

CentOS设置静态IP地址

vi /etc/sysconfig/network-scripts/ifcfg-enp0s8

 

BOOTPROTO=static #dhcp改为static

IPADDR=172.31.44.100 #静态IP

GATEWAY=172.31.44.1 #默认网关

NETMASK=255.255.255.0 #子网掩码

DNS1=172.28.4.103 #DNS 配置

 

CentOS 7 修改主机名

hostname

hostnamectl set-hostname "Registry"

hostname

 

关防火墙

/etc/init.d/iptables stop

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

systemctl restart network #重启网络 service network restart

 

打开端口号

vim /etc/sysconfig/iptables

centos防火墙开启端口--22端口后添加一行

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

service iptables restart

 

Centos7设置成开机默认命令行模式

1,命令模式

systemctl set-default multi-user.target

2,图形模式

systemctl set-default graphical.target

 

ssh [email protected]

 

如何开启Centos7系统的SSH服务

1、登录Centos7系统。

示例:使用root用户登录。

注:若为非root用户登录,输入执行某些命权限不够时需加sudo

 

2、查看SSH是否安装。

输入命令:rpm -qa | grep ssh

注:若没安装SSH则可输入:yum install openssh-server安装。

 

3、启动SSH服务。

输入命令:service sshd restart  重启SSH服务。

  命令:service sshd start 启动服务 |  命令:service sshd stop 停止服务  

  重启后可输入:netstat -antp | grep sshd 查看是否启动22端口(可略)。

 

4、如何设置SSH服务为开机启动?

输入命令:chkconfig sshd on 即可。

注:若是chkconfig sshd off则禁止SSH开机启动。

 

5、远程访问连接Centos7系统。

Windows下使用:puttySecureCRT可远程连接SSH服务。

Linux下直接使用命令:ssh ip(如:ssh 192.168.1.11)。

 

配置Java环境变量

vim /etc/profile

 

export JAVA_HOME=/root/Java/jdk1.7.0_79

export PATH=$JAVA_HOME/bin:$PATH

 

export MAVEN_HOME=/root/Java/apache-maven-3.3.9

export PATH=$MAVEN_HOME/bin:$PATH

 

source /etc/profile

 

cron

http://blog.csdn.net/yq495/article/details/7399277

1yum install vixie-cron

2vi backup.sh

#!/bin/sh

# file:/home/mysql/backup.sh

today=`date +%Y%m%d`

echo $today

mysqldump -uroot -pYunluqwe -h 127.0.0.1 yunlu > /home/mysql/backup/$today.sql

3crontab -e

33 3 * * * /home/mysql/backup/backup.sh

4/sbin/service crond restart

 

Centos6.5下安装Memcached完整示例

http://www.tuicool.com/articles/qYJBVb

 

我的ZenTao禅道的安装(windowslinux下都试过)

http://blog.csdn.net/lwx2615/article/details/6124125

 

安装mysql 

http://www.cnblogs.com/hb_cattle/archive/2011/10/16/2213825.html

卸载老版本

yum remove mysql-libs-5.1.71-1.el6.x86_64

rpm -qa | grep mysql

yum -y install perl

yum install libaio

rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm

rpm -ivh MySQL-server-5.5.39-2.rhel5.x86_64.rpm

rpm -ivh MySQL-client-5.5.39-2.rhel5.x86_64.rpm

rpm -ivh MySQL-devel-5.5.39-2.rhel5.x86_64.rpm

 

修改 mysql 字符集

cp /usr/share/doc/mysql-server-5.1.61/my-medium.cnf /etc/my.cnf

vi /etc/my.cnf

[client]

default-character-set=utf8

 

[mysqld]

character-set-server=utf8

collation-server=utf8_general_ci

init-connect = ‘set names utf8‘

 

flush privileges;

 

Centos mysql 配置主从

 

Master

# The MySQL server

[mysqld]

user = mysql

pid-file = /var/lib/mysql/mysqld.pid

socket = /var/lib/mysql/mysqld.sock

port = 3306

basedir = /usr

datadir = /var/lib/mysql

tmpdir = /tmp

log-bin = master-bin

log-bin-index = master-bin.index

server-id = 1

 

CREATE USER repl_user;

GRANT REPLICATION SLAVE ON *.* TO repl_user IDENTIFIED BY ‘[email protected]#qwe‘;

 

Slave

# The MySQL server

[mysqld]

user = mysql

pid-file = /var/lib/mysql/mysqld.pid

socket = /var/lib/mysql/mysqld.sock

port = 3306

basedir = /usr

datadir = /var/lib/mysql

tmpdir = /tmp

server-id = 2

relay-log-index = slave-relay-bin.index

relay-log = slave-relay-bin

log-bin=mysql-bin

?

注释掉下面的

#server-id = 1

 

CHANGE MASTER TO MASTER_HOST = ‘60.194.51.21‘, MASTER_PORT = 3306, MASTER_USER = ‘repl_user‘, MASTER_PASSWORD = ‘[email protected]#qwe‘;

 

START SLAVE;

 

停止主从复制

slave stop;

reset slave;

flush privileges;

 

http://blog.csdn.net/shaobingj126/article/details/8128287

 

以上是关于Centos 安装配置的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7上安装并配置KVM,以及通过KVM安装CentOS系统

CentOS 7安装和配置ssh

CentOS7最小安装网络配置

centos7最小化安装环境配置

CentOS7如何安装配置Reids?

安装centos7配置静态网络