CentOs笔记
系统
CentOs7,最小安装,使用 Ext4,/ ,/boot,/swap 使用标准分区,另一个分区做为数据分区,使用 LVM.
查看版本:lsb_release -a
更新:
163 镜像: http://mirrors.163.com/.help/centos.html
阿里云镜像:https://mirrors.aliyun.com/centos/
yum update
修改计算机名
http://www.centoscn.com/CentOS/config/2014/1031/4039.html
hostnamectl set-hostname <host-name>
重启:shutdown -r now
关机: shutdown -h now
RPM
安装: rpm -ivh rpm文件
更新: rpm -Uvh rpm文件
卸载:rpm -e 软件名
Yum
安装:yum install xxx
卸载:yum remove xxx
命令:http://www.centoscn.com/CentOS/help/2013/1019/1906.html
防火墙
安装后,没有启用网卡: http://www.cnblogs.com/hwd-cnblogs/p/4003607.html
防火墙添加端口号
firewall-cmd --zone=public --add-port=27017/tcp --permanent firewall-cmd --reload
如果添加Http端口,则:
firewall-cmd --permanent --zone=public --add-service=http
关闭防言墙
centos 7:
systemctl stop firewalld.service #停止
systemctl disable firewalld.service #禁用
之前的版本:
service iptables stop #停止
chkconfig iptables off #禁用
开放端口
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #允许3306数据库端口通过防火墙
service iptables save
cat /etc/sysconfig/iptables
service iptables restart
http://www.cnblogs.com/meetrice/p/5309666.html
关闭端口
1. 列规则 /sbin/iptables -L -n –line-number
2. iptables -D INPUT $num ($num为上一个命令列出的数字)
查看网络
使用 netstat,ifconfig,需要: yum install net-tools
设置静态IP,编辑: vim /etc/sysconfig/network-scripts/ifcfg-em1
TYPE=Ethernet BOOTPROTO=dhcp #IPADDR=192.168.16.123 #NETMASK=255.255.255.0 #NETWORK=192.168.16.1 DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=no IPV6_AUTOCONF=no IPV6_DEFROUTE=no IPV6_PEERDNS=no IPV6_PEERROUTES=no IPV6_FAILURE_FATAL=no NAME=em1 UUID=ec1fcc2a-522e-4028-8972-93d6c7935bfb DEVICE=em1 ONBOOT=yes
修改静态IP:
BootPROTO=Static
把下面的三行注释去除。即可。
但是可能上不了网。
设置时区:
https://www.cnblogs.com/st-jun/p/7737188.html
timedatectl set-timezone Asia/Shanghai
软件
安装Mariadb
Mariadb.org 官方安装教程:https://downloads.mariadb.org/mariadb/repositories/#mirror=opencas&distro=CentOS&distro_release=centos7-amd64--centos7&version=10.0
/etc/yum.repos.d/mariadb.repo
# MariaDB 10.0 CentOS repository list - created 2015-08-24 04:32 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.0/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
sudo yum install MariaDB-server MariaDB-client
看状态:service mysql status
启动:service mysql start
安装Mono
http://www.mono-project.com/docs/getting-started/install/linux/#centos-7-fedora-19-and-later-and-derivatives
需要安装 yum-utils 才能使用 yum-config-manager
yum -y install yum-utils
http://software.opensuse.org/download/package?project=home:tpokorra:mono&package=mono-opt
cd /etc/yum.repos.d/ wget http://download.opensuse.org/repositories/home:tpokorra:mono/CentOS_CentOS-7/home:tpokorra:mono.repo yum install mono-opt
http://www.centoscn.com/image-text/install/2015/0522/5508.html
jexus
http://www.jexus.org/
ActiveMq
http://www.cnblogs.com/newsea/p/4740834.html
安装 Jexus
https://jexus.codeplex.com/
安装 Htop
http://elearning.wsldp.com/pcmagazine/centos-install-htop/
![]() |
作者:NewSea 出处:http://newsea.cnblogs.com/
QQ,MSN:iamnewsea@hotmail.com 如无特别标记说明,均为NewSea原创,版权私有,翻载必纠。欢迎交流,转载,但要在页面明显位置给出原文连接。谢谢。 |