linux系统命令备忘

 

ANT

tar -zxvf apache-ant-1.8.1-bin.tar.gz

vi /etc/profile

ANT_HOME=/usr/local/apache-ant-1.8.1  

PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH  

export JAVA_HOME JAVA_BIN ANT_HOME PATH CLASSPATH  

source /etc/profile

网络

配置ip地址   /etc/sysconfig/network-scripts/ifcfg-eth0

 

关闭防火墙 service iptables stop 

 

时间

查看时区 cat /etc/sysconfig/clock

 

重置时区 cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

 

重置时间 date –s 06/22/11 date –s 15:52:00

 

将新时间写入CMOS clock –w

 

java

将JDK加入环境 vi /etc/profile

export JAVA_HOME=/home/jdk1.6.0

export CLASSPATH=/home/jdk1.6.0/jre/lib:$JAVA_HOME/lib:$CLASSPATH

export PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/bin:$PATH

 

将环境文件马上起效: 使用source /etc/profile

 

mysql

设置默认字符集为utf-8

vi /etc/my.cnf 

在文件最后加入 

default-character-set = utf8

[mysql]default-character-set=utf8

 

设置mysql随系统启动 chkconfig mysqld on

 

启动服务 service mysqld start

 

设置根用户密码(root):mysqladmin –u root password root。

 

赋予权限给远程用户

grant all on *.* to 'test'@'%' IDENTIFIED BY 'root' with grant option;

grant all on *.* to 'test'@'127.0.0.1' IDENTIFIED BY 'root' with grant option;

grant all on *.* to 'test'@'localhost' IDENTIFIED BY 'root' with grant option;

 

设置数据库上传文件最大值

set global max_allowed_packet = 16*1024*1024*10

 

编译源码包

mkdir -p /usr/local/src/mysql

mv  mysql-5.1.42.tar.gz  /usr/local/src/mysql

cd  /usr/local/src/mysql

tar zxvf  mysql-5.1.42.tar.gz

cd mysql-5.1.42.tar.gz

./configure --help

CC=gcc CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-thread-safe-client --enable-assembler --with-big-tables --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static  --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=complex 

make

make install

cp ./support-files/my-medium.cnf  /etc/my.cnf

./scripts/mysql_install_db --user=mysql

chown -R mysql.mysql /usr/local/mysql/var

chmod -R 700 /usr/local/mysql/var

cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld

chmod +x /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

chkconfig --list mysqld

service mysqld start

vi /etc/profile

PATH=$PATH:/usr/local/mysql/bin

export PATH

./etc/profile

你可能感兴趣的:(linux)