RedHat
2016-01-14 14:14
796 查看
RedHat
-基于CentOS6.5 和 RHEL6.4
sf2gis@163.com
2015年8月21日
2015年9月21日添加SVN
2015年10月10日添加mysql配置表名大小写
2015年12月16日添加SELinux
参考:http://blog.csdn.net/vshadow/article/details/8616144
参考:http://jingyan.baidu.com/article/0bc808fc46c2af1bd485b982.html
-a:所有包。
-i:已经安装的包。
-qa:查找所有包。
grep命令:按照正则表达式查找。
rpm –qa|grep xx:从所有的rpm包中查找 xx。
参考其中的包,如果没有网络可以使用安装盘中包进行安装。
安装完成后选择System->Perfermence->inputMethod->iBus
配置输入法的参数,选择使用的输入法。
参考:http://jingyan.baidu.com/article/20b68a885a3607796cec622c.html
--config-sourcexml:readwrite:/etc/gconf/gconf.xml.mandatory \
--type int \
--set /apps/metacity/general/num_workspaces 数目
CommandLine->GUI:Alt+F1
如果GUI还没有启动:使用startx启动GUI。如果已经启动,再次startx会报错。
参考:http://blog.secaserver.com/2012/01/centos-enable-centos-gnome-desktop/
http://www.linuxdiyf.com/viewarticle.php?id=86126
参考:http://blog.csdn.net/xinhaozheng/article/details/4291173
参考:http://www.cnblogs.com/gzrhappy/articles/2220868.html
启动telnet服务:chkconfigtelnet on
参考:
http://linuxbsdos.com/2015/01/17/how-to-install-the-latest-openssh-on-windows-7-and-windows-8/
参考:http://www.infoq.com/cn/news/2015/06/windows-SSH?utm_source=tuicool
参考:http://blog.sina.com.cn/s/blog_4a9e49b50100z58x.html
参考:http://www.cnblogs.com/kerrycode/p/3315793.html
关闭防火墙:service iptables stop
允许指定网络:service iptables restart
重启启防火墙:service iptables restart
如果选项了第一个项,则每次连接都需要服务端手动点击同意连接。
参考:
http://www.howtogeek.com/howto/ubuntu/allow-remote-control-to-your-desktop-on-ubuntu/
启动客户端:viewer,操作与linux相似。
或从安装盘中查找相关软件安装。
安装完成后,使用rpm –qi mysql-server
设置开机启动:使用chkconfig mysqld on
设置密码:mysqladmin –u root password “输入初始密码”。
进入数据库:mysql –u root –p
创建数据库:create databases crm;
显示数据库:show databases;
配置文件:/etc/my.cnf
数据库位置:/var/lib/mysql
日志:/var/log
表示所有表名都转换为小写;如果是0,则按实际输入区分大小写。
http://blog.csdn.net/waterxcfg304/article/details/36665031
删除旧版本:rm –rf/usr/lib64/firefox
复制新版本:mv firefox /usr/lib64/
删除旧链接:rm /usr/bin/firefox
建立新链接:ln –s/usr/lib64/firefox/firefox /usr/bin/firefox
参考:http://www.centoscn.com/image-text/install/2014/1112/4111.html
安装部署:参考:http://www.linuxidc.com/Linux/2012-09/70782.htm
修改注册表:添加一个dword,值为1。
64位:[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VisualSVN\VisualSVNServer]
32位:[HKEY_LOCAL_MACHINE\SOFTWARE\VisualSVN\VisualSVNServer]
参考:http://www.cnblogs.com/visi_zhangyang/archive/2012/04/05/2433189.html
http://blog.csdn.net/duguteng/article/details/7726536
http://longdick.iteye.com/blog/457915/
使用svn命令时,提示输入用户名和密码。
测试:gcc –v
参考:http://www.cnblogs.com/Anker/p/3203402.html
不要直接使用g++安装,会出现无法找到包的提示。
测试:g++ -v
参考:http://blog.sina.com.cn/s/blog_6f561cc301015emv.html
参考:http://baike.baidu.com/view/157053.htm
删除软件:yum remove foo-x.x.x.rpm或者yum erase foo-x.x.x.rpm
升级软件:yum upgrade foo或者yumupdate foo
查询信息:yum info foo
搜索软件(以包含foo字段为例):yum searchfoo
显示软件包依赖关系:yum deplist foo
更多命令参见:http://www.360doc.com/content/14/1013/16/18924983_416579431.shtml
http://baike.baidu.com/view/504557.htm
http://zhidao.baidu.com/link?url=xXU9BksHCAGYS7d9coJPMncj1DfSLJEKb-6PTZRjvNVMqJUi1cK1s0uh6hXIA-cg-8W0lV8B-IpTA6mpqjZu2K
enforcing:默认,如果违反则禁止。
permissive:允许,如果违反依然允许,但记录操作。
disabled:无效,关闭SELinux。
运行策略:只针对目标targeted(默认)和mis(多级)
# This filecontrols the state of SELinux on the system.
# SELINUX= cantake one of these three values:
# enforcing - SELinux security policy isenforced.
# permissive - SELinux prints warningsinstead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= cantake one of these two values:
# targeted - Targeted processes areprotected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
参考:http://jingyan.baidu.com/article/6d704a131ba67828da51ca73.html
http://bguncle.blog.51cto.com/3184079/957315
http://baike.baidu.com/view/487687.htm
http://www.toxingwang.com/management/security/1011.html
-基于CentOS6.5 和 RHEL6.4
sf2gis@163.com
2015年8月21日
2015年9月21日添加SVN
2015年10月10日添加mysql配置表名大小写
2015年12月16日添加SELinux
1 系统设置
1.1 root默认密码:安装时指定的用户名和密码,root使用此密码。
参考:http://blog.csdn.net/yyzhq/article/details/170415891.2 用户切换:suroot
切换为原用户:exit参考:http://blog.csdn.net/vshadow/article/details/8616144
1.3 提升用户权限为root:/etc/sudoers
1.3.1使用root权限:切换到root用户,su root。
1.3.2设置文件可写入:设置sudoers的权限为reader and writer(默认为readyonly)。
使用shell(推荐)或UI。1.3.3添加用户:在root ALL=(ALL) ALL之下添加目标用户。
1.3.4设置文件为只读:将sudoers文件的权限修改为之前的readonly。
参考:http://blog.chinaunix.net/uid-25305993-id-126661.html1.4 快捷键:System->perfermence->keyboardshortcuts
1.4.1快速打开Terminal
System->perfermence->keyboardshortcuts->run a terminal,默认为不可用,添加新的快捷键,Ctrl+T。参考:http://jingyan.baidu.com/article/0bc808fc46c2af1bd485b982.html
1.5 32位和64位:不兼容,64位不能直接运行32位程序。
注意:32位程序,在64位机器上会显示为普通文件,无法执行。1.6 RPM程序安装:rpm –ivh software
参考:http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/10/08/2203153.html1.7 RPM程序查找:rpm –qa|grep xx
-q:查找。-a:所有包。
-i:已经安装的包。
-qa:查找所有包。
grep命令:按照正则表达式查找。
rpm –qa|grep xx:从所有的rpm包中查找 xx。
1.8 RPM程序删除:rpm –e xx
1.9 安装中文输入法:ibus
yum install “@Chinese Support”参考其中的包,如果没有网络可以使用安装盘中包进行安装。
安装完成后选择System->Perfermence->inputMethod->iBus
配置输入法的参数,选择使用的输入法。
参考:http://jingyan.baidu.com/article/20b68a885a3607796cec622c.html
1.10 快捷方式:createLanucher
参见:Linux.docx 快捷方式章节。1.11 设置Workspace数:gconftool-2
gconftool-2 --direct\--config-sourcexml:readwrite:/etc/gconf/gconf.xml.mandatory \
--type int \
--set /apps/metacity/general/num_workspaces 数目
1.12 在同一个窗口打开文件夹
RHEL默认每次双击都会打开一个文件浏览窗口,设置文件浏览器行为可以只使用同一个窗口浏览不同的文件夹。1.13 界面切换:ctrl+alt+F2~F6
GUI->CommandLine:Ctrl+Alt+F2~F6CommandLine->GUI:Alt+F1
如果GUI还没有启动:使用startx启动GUI。如果已经启动,再次startx会报错。
参考:http://blog.secaserver.com/2012/01/centos-enable-centos-gnome-desktop/
http://www.linuxdiyf.com/viewarticle.php?id=86126
1.14 设置Terminal的字符编码:set character encoding
如果没有想要的,点出添加或删除选择。1.15 查看命令帮助文件:man命令。
显示命令的详细帮助说明。1.16 服务设置:service,chkconfig
1.17 应用服务状态控制:service服务名 start/stop/restart/status
查看全部服务:service --status-all参考:http://blog.csdn.net/xinhaozheng/article/details/4291173
1.18 系统服务状态控制:chkconfig服务名 on/off
用于系统级服务的自动启动、关闭等设置。参考:http://www.cnblogs.com/gzrhappy/articles/2220868.html
2 远程连接:telnet,SSH
2.1 telnet:最初的远程连接标准,不安全,现已经被SSH取代,端口23。
参考:2.1.1安装:从yum或安装盘中安装telnet/telnet-server。
需要先安装xinet程序。2.1.2打开服务器:启动xinetd,telnet。
启动xinet服务:servicexinetd start启动telnet服务:chkconfigtelnet on
2.1.3测试:telnet localhost
2.1.4linux连接Windows:连接后使用dos命令,exit退出。
2.1.4.1 需要在windows中开启telnet服务:控制面板中打开telnet服务器和客户端。
2.1.4.2 打开telnet服务:默认是关闭的。从管理-》服务中设置为启动。
参考:http://soft.yesky.com/204/31059704.shtml2.1.4.3 设置字符编码
注意:如果windows 是中文操作系统,则可能出现乱码。应该将centos的terminal编译设置为中文。参见:设置Terminal的字符编码:set character encoding2.1.5windows连接Linux:windows作为客户端连接linux服务器。
2.2 SSH(推荐):安全的远程连接标准。
2.2.1安装openSSH:如果没有安装SSH,可以安装ssh的客户端和服务器。
OpenSSH是SSH协议的开源实现。2.2.2打开服务器:service sshd start。
2.2.3测试:ssh,sshd。
2.2.4Linux连接Windows:OpenSSH for windows,putty。
2.2.4.1 Windows安装OpenSSH服务器:由于Windows系统默认不支持SSH,需要安装第三方软件OpenSSH。
下载地址:http://www.mls-software.com/opensshd.html参考:
http://linuxbsdos.com/2015/01/17/how-to-install-the-latest-openssh-on-windows-7-and-windows-8/
2.2.4.2 Windows启动SSH服务:netstart opensshd。
测试:ssh localhost参考:http://www.infoq.com/cn/news/2015/06/windows-SSH?utm_source=tuicool
2.2.4.3 Linux连接Windows:SSH
2.2.5Windows连接Linux:客户端使用putty。
2.2.5.1 Linux安装OpenSSH服务器:由于Ubuntu自身只有OpenSSH的client软件,而Putty连接需要OpenSSH的Server端。
sudo apt-get install openssh-server2.2.5.2 设置Linux的编码:Window->Translation,设置UTF-8。
参考:http://www.linuxidc.com/Linux/2012-06/63079.htm2.2.6Windows连接Windows:设置中文显示。
显示中文:默认使用UTF-8显示中文系统为乱码。设置Window->Transaction->remote character->use font encoding2.2.7Linux连接Linux
3 远程桌面:tigerVNC
3.1 服务器:tigerVNC-server
3.1.1安装:如果系统没有vncserver,则到系统安装盘中查找tigerVNC-server,在root中安装。
rpm -ivh vnc-server-4.1.2-14.el5_3.1.i386.rpm参考:http://blog.sina.com.cn/s/blog_4a9e49b50100z58x.html
3.1.2启动服务:vncserver。
3.1.3查看当前用户下的服务列表:vncserver –list
3.1.4关闭指定服务:vncserver –kill N
3.1.5配置安全选项:防火墙,验证密码
3.1.5.1 防火墙设置:允许指定网络内的用户访问。
默认情况下,防火墙将阻止其它计算机。为了能够登录桌面,需要先关闭防火墙,设置网络白名单后,使用vncviewer进入ui界面(参见启动远程连接:vncviewer,根据提示输入服务器和密码。),再开启防火墙。参考:http://www.cnblogs.com/kerrycode/p/3315793.html
关闭防火墙:service iptables stop
允许指定网络:service iptables restart
重启启防火墙:service iptables restart
3.1.5.2 验证密码:每次等录需要验证。
System->perferences->RemoteDesktop->Security->Require the user to enter this password。然后输入一个验证密码。如果选项了第一个项,则每次连接都需要服务端手动点击同意连接。
参考:
http://www.howtogeek.com/howto/ubuntu/allow-remote-control-to-your-desktop-on-ubuntu/
3.2 客户端:tigerVNC
3.2.1安装:如果系统没有vncviewer,则到系统安装盘中查找tigerVNC,在root中安装。
3.2.2启动远程连接:vncviewer,根据提示输入服务器和密码。
3.3 虚拟机设置:桥接网络
使用虚拟机时,默认使用NAT共享模式,此时无法使用vncviewer连接。修改为桥接模式后,可以正常登录。3.4 Windows设置:tigerVNC
软件:下载安装tigerVNC。启动客户端:viewer,操作与linux相似。
4 安装MySql:su才有权限操作。
参考:http://www.cnblogs.com/shenliang123/p/3203546.html4.1 查看是否已经完装MySQL
rpm –qa|grepmysql4.2 安装MySQL:yum或安装盘
yum install mysql-server mysql mysql-deve或从安装盘中查找相关软件安装。
安装完成后,使用rpm –qi mysql-server
4.3 启动MySQL服务:service mysqld start
MySQL的服务名称为mysqld(mysql daemon)。设置开机启动:使用chkconfig mysqld on
4.4 操作MySQL数据库:mysql,mysqladmin
注意:初始用户为root,无密码。设置密码:mysqladmin –u root password “输入初始密码”。
进入数据库:mysql –u root –p
创建数据库:create databases crm;
显示数据库:show databases;
4.5 配置MySQL:log,conf
4.5.1配置信息
mysql --help可以查看所有的配置信息。配置文件:/etc/my.cnf
数据库位置:/var/lib/mysql
日志:/var/log
4.5.2设置表名大小写规则:在windows下默认是不区分大小写的,在linux默认是区分大小写的。
4.5.2.1 打开/ect/my.cnf,在【mysqld】下添加一行
lower_case_table_names=1表示所有表名都转换为小写;如果是0,则按实际输入区分大小写。
4.5.2.2 重启数据库:service mysqld restart
4.5.2.3 测试:select * from employee;select * from EMPLOYEE;
参考:http://www.cnblogs.com/AloneSword/archive/2013/06/06/3122898.htmlhttp://blog.csdn.net/waterxcfg304/article/details/36665031
5 更新FireFox
5.1 下载最新的FireFox,解压。
5.2 更新版本:删除旧版本,复制新版本。
查找旧版本:whereis firefox。删除旧版本:rm –rf/usr/lib64/firefox
复制新版本:mv firefox /usr/lib64/
5.3 更新命令链接:删除旧链接,建立新链接。
目标是在bash中直接输入firefox命令就可以启动。删除旧链接:rm /usr/bin/firefox
建立新链接:ln –s/usr/lib64/firefox/firefox /usr/bin/firefox
5.4 更新图标:左上角快捷图标。
右键->properties->选择图标。参考:http://www.centoscn.com/image-text/install/2014/1112/4111.html
6 SVN服务器
7 SVN客户端
7.1 目标:安装SVN客户端,能够浏览、签出、更新、比较代码等。
7.2 原理:subversion程序。
7.3 流程:CentOS安装subversion,VisualSVN(Windows)安装GNU证书。
7.4 方法:GUI客户端SmartSVN
收费软件,个人免费使用31天。推荐在Eclipse下用Subclipse(参见:SVN-Eclipse插件)。安装部署:参考:http://www.linuxidc.com/Linux/2012-09/70782.htm
7.5 方法:命令行客户端
7.5.1安装subversion:sudoyum install –y subversion。
安装后使用SVN help查看帮助,验证安装。7.5.2服务器端VisualSVN安装GNU证书:
操作-》properties->certificate->changecertificate->create new self-signed certificate然后默认创建,最后提示一个需要读取注册表CreateGnuTLSCompatibleCertificate的值。修改注册表:添加一个dword,值为1。
64位:[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VisualSVN\VisualSVNServer]
32位:[HKEY_LOCAL_MACHINE\SOFTWARE\VisualSVN\VisualSVNServer]
参考:http://www.cnblogs.com/visi_zhangyang/archive/2012/04/05/2433189.html
http://blog.csdn.net/duguteng/article/details/7726536
7.5.3使用SVN:
参考:http://www.jb51.net/os/RedHat/220595.htmlhttp://longdick.iteye.com/blog/457915/
7.5.3.1 浏览list:格式:svn list url
第一次登录需要授权。7.5.3.2 签出checkout:格式:svn checkout url targetDir
7.5.3.3 导入import:格式:svn import targetDir url –m logMessage
7.5.3.4 更改用户
~/.subversion/svn.simple下找到一个txt文件,打开,修改用户名和密码。使用svn命令时,提示输入用户名和密码。
7.5.3.5 签入commit:格式:svn import targetDir url –m logMessage
参考:http://www.jb51.net/os/RedHat/73031.html8 SVN-Eclipse插件
参考:http://blog.51yip.com/eclipse/471.html8.1 安装:subclipse
8.1.1下载页面:http://subclipse.stage.tigris.org/中找到相应eclipse版本的下载地址。
8.1.2安装软件:help-》installnew software-》将上述下载地址中eclipse的地址copy到eclipse的workwith中。然后add。
选中所有,然后安装。8.1.3安装完成后需要重启。
8.2 使用:subclipse
8.2.1从SVN中导入工程:File->new->others->SVN
8.2.2功能:所有的功能,都可以在右键-》team中找到。
9 GCC & G++
9.1 GCC
安装:sudo yum install gcc测试:gcc –v
参考:http://www.cnblogs.com/Anker/p/3203402.html
9.2 G++
安装:sudo yum install gcc-c++不要直接使用g++安装,会出现无法找到包的提示。
测试:g++ -v
参考:http://blog.sina.com.cn/s/blog_6f561cc301015emv.html
10 YUM:软件包管理程序
yum:yellow dogupdate,modified。(黄狗升级器?是真的吗?)参考:http://baike.baidu.com/view/157053.htm
10.1 常用命令:
安装软件(以foo-x.x.x.rpm为例):yum install foo-x.x.x.rpm删除软件:yum remove foo-x.x.x.rpm或者yum erase foo-x.x.x.rpm
升级软件:yum upgrade foo或者yumupdate foo
查询信息:yum info foo
搜索软件(以包含foo字段为例):yum searchfoo
显示软件包依赖关系:yum deplist foo
更多命令参见:http://www.360doc.com/content/14/1013/16/18924983_416579431.shtml
11 防火墙iptables
11.1 目标:建立本地和外部之间的通信过滤器。
11.2 原理:过滤连接,处理后再传输。
11.3 流程:启动/关闭。
启动、关闭:service iptables start/stop/restart…11.4 方法:配置
参考:http://www.cnblogs.com/JemBai/archive/2009/03/19/1416364.htmlhttp://baike.baidu.com/view/504557.htm
11.4.1查看:iptables –L –n.
11.4.2添加:iptables –A 传输方法 –p 策略 –j 处理
iptables -A INPUT -p tcp --dport 21 -j ACCEPT11.4.3传输方法: 外部传入(INPUT),传出(OUTPUT),转发(FORWARD)。
参考:http://zhidao.baidu.com/link?url=xXU9BksHCAGYS7d9coJPMncj1DfSLJEKb-6PTZRjvNVMqJUi1cK1s0uh6hXIA-cg-8W0lV8B-IpTA6mpqjZu2K
11.4.4处理方式:接受(ACCEPT),拒绝(REJECT),丢弃(DROP),重定向(REDIRECT)。
参考:http://blog.chinaunix.net/uid-26495963-id-3279216.html12 SELinux:安全增强的Linux
12.1 目标:控制进程的访问权限,不仅包括外部访问,还控制内部访问。
12.2 原理:从内核控制进程权限(Linux上默认具有SELinux)(所以可能会有很多权限限制,关了防火墙依然有)。推荐关闭。
参考:http://www.zhihu.com/question/2055953812.3 方法:查看、关闭/开启、修改。
12.3.1查看:getsebool –a
12.3.2修改:setsebool –P 权限 true/false
12.3.3关闭/开启:修改/etc/sysconfig/selinux配置文件,永久更改
默认是enforcing。12.3.3.1 查看当前的状态:sestatus或getenforce.
12.3.3.2 临时关闭:setenforce 0
使用permissive状态。重启后又恢复为配置文件策略。12.3.3.3 临时开启:setenforce 1
使用enforcing状态。重启后又恢复为配置文件策略。12.3.3.4 修改配置文件,永久生效:vi /etc/sysconfig/selinux,需要重启后生效。
SELinux的状态:enforcing:默认,如果违反则禁止。
permissive:允许,如果违反依然允许,但记录操作。
disabled:无效,关闭SELinux。
运行策略:只针对目标targeted(默认)和mis(多级)
# This filecontrols the state of SELinux on the system.
# SELINUX= cantake one of these three values:
# enforcing - SELinux security policy isenforced.
# permissive - SELinux prints warningsinstead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= cantake one of these two values:
# targeted - Targeted processes areprotected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
参考:http://jingyan.baidu.com/article/6d704a131ba67828da51ca73.html
http://bguncle.blog.51cto.com/3184079/957315
http://baike.baidu.com/view/487687.htm
http://www.toxingwang.com/management/security/1011.html
相关文章推荐
- Linux socket 初步
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- 基于 Red Hat 的发行版 Oracle Linux 正式发布Oracle Linux 7.1
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Centos6 编译安装Python
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)