---
title: "centos 使用总结"
author: "macleo"
date: "2013-06-19T18:09:00Z"
tags: []
categories: ["操作系统"]
slug: "centos"
draft: false
lastmod: "2013-06-19T18:10:28Z"
id: 1889372
url: "https://macleo.iteye.com/blog/1889372"
---

1.ssh 用putty
<http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html>
2.安装 mysql
<http://os.51cto.com/art/201002/184568.htm>

3.开启mysql的远程连接
<http://www.fantxi.com/blog/archives/enable-remote-access-mysql-centos/>

> 当服务器没有运行php、没装phpmyadmin的时候，远程管理mysql就显得有必要了。因为在CentOS下设置的，所以标题加上了CentOS，以下的命令在debian等系统下应该也OK。
> 
> mysql -u root -p mysql # 第1个mysql是执行命令，第2个mysql是系统数据名称
> 在mysql控制台执行:
> 
> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
> # root是用户名，%代表任意主机，'123456'指定的登录密码（这个和本地的root密码可以设置不同的，互不影响）
> flush privileges; # 重载系统权限
> exit;
> 允许3306端口
> 
> iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
> # 查看规则是否生效
> iptables -L -n # 或者: service iptables status
> 
> # 此时生产环境是不安全的，远程管理之后应该关闭端口，删除之前添加的规则
> iptables -D INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
> PS，上面iptables添加/删除规则都是临时的，如果需要重启后也生效，需要保存修改:
> service iptables save # 或者: /etc/init.d/iptables save
> 另外，
> vi /etc/sysconfig/iptables # 加上下面这行规则也是可以的
> -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
> 
> 远程管理数据库的软件，win系统下可以使用SQLyog，用了几种远程软件，感觉这个用起来蛮不错的。



4.将mysql放入启动列表里：
将CentOS Mysql放入到启动服务列表中的方法


```shell
[root@sample ~]# chkconfig mysqld on　 ← 设置MySQL服务随系统启动自启动  
[root@sample ~]# chkconfig --list mysqld　 ← 确认MySQL自启动  
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off　 ← 如果2--5为on的状态就OK 
```


5.安装tomcat
<http://albany.blog.51cto.com/3440797/671872>
其余同mysql

6.yum的使用：
<http://blog.cnr.cn/18/viewspace-8099.html>

<http://www.blogjava.net/jvict/articles/305149.html>
7.安装java7
<http://www.th7.cn/Program/java/2011/09/01/41211.shtml>