Linux工具安装配置

1、修改主机名/添加别名访问

修改/etc/sysconfig/network中的hostname
NETWORKING=yes
HOSTNAME=dlserver01;

修改/etc/hosts文件

172.16.50.123 dlserver01 # Added by NetworkManager
127.0.0.1 localhost.localdomain localhost
::1 dlserver01 localhost6.localdomain6 localhost6
172.16.50.124 dlserver02
172.16.50.125 dldb01

 

2、时间设置

date -R
date -s 20140915
date -s 15:57:30

 

3、jdk

3.1、

/etc/profile
export JAVA_HOME=/usr/lib/jvm/java-7
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

3.2、

chmod 777 bin

source ~/.bashrc
3.3、
java -version

 

4、tomcat
tar zxvf apache-tomcat-6.0.39.tar.gz
4.1、server.xml 8080 -- 8081

4.2、tomcat-users.xml

<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="admin" password="admin" roles="manager"/>

4.2、配置开机自动启动
vi /etc/rc.local

export JAVA_HOME=/usr/lib/jvm/java-7
/dinglicom/tomcat/bin/startup.sh

4.3、其它机器不能访问,开启8080端口或者关闭防火墙

4.3.1、 开启8080端口。
在/ect/sysconfig下编写iptables文件
加入一行
-A RH-Firewall-1-INPUT –m state NEW –m tcp –p tcp –dport 8080 –j ACCEPT
4.3.2、关闭防火墙
(1)关闭立即生效,重启后又开启
service iptables stop
同理:立即开启 service iptable start
(2)重启后生效
chkconfig iptables off
同理:重启后开启 chkconfig service on

 

5、yum

5.1、http://blog.itpub.net/25313300/viewspace-708509/

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-cron-3.2.29-40.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-cron-3.2.29-40.el6.centos.noarch.rpm rpm -ivh yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

5.2、更新repo文件
mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.repo.bak
vi /etc/yum.repos.d/rhel-debuginfo.repo
内容为:
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#packages used/produced in the build but not released
#[addons]
#name=CentOS-$releasever - Addons
#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
gpgcheck=1
enabled=0

 

6、MySQL(linux下使用yum安装mysql)

1、安装
查看有没有安装过:
yum list installed mysql*
rpm -qa | grep mysql*

查看有没有安装包:
yum list mysql*

安装mysql客户端:
yum install mysql

安装mysql 服务器端:
yum install mysql-server
yum install mysql-devel

2、启动&&停止

数据库字符集设置
mysql配置文件/etc/my.cnf中加入default-character-set=utf8

启动mysql服务:
service mysqld start或者/etc/init.d/mysqld start
停止:
service mysqld stop
2、登录

创建root管理员:
mysqladmin -u root password zxc

登录:
mysql -u root -p输入密码即可。
忘记密码:
service mysqld stop
mysqld_safe --user=root --skip-grant-tables
mysql -u root
use mysql
update user set password=password("new_pass") where user="root";
flush privileges;

3、远程访问
开放防火墙的端口号
mysql增加权限:mysql库中的user表新增一条记录host为“%”,user为“root”。

4、Linux MySQL的几个重要目录
数据库目录
/var/lib/mysql/
配置文件
/usr/share /mysql(mysql.server命令及配置文件)
相关命令
/usr/bin(mysqladmin mysqldump等命令)
启动脚本
/etc/rc.d/init.d/(启动脚本文件mysql的目录)

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。