linux tips

启动Memcache的服务器端:
/usr/local/bin/memcached -d -u root

 

设置vsftpd上传根路径

local_root=/home/lich/upload

 

 

设置 dns 

vi /etc/resolv.conf 

 

nameserver 202.96.209.5
nameserver 202.96.199.132
nameserver 202.96.199.133

 

/etc/init.d/networking restart

 

 

编译安装mysql 改变安装路径 数据路径

./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data

make

make install

 

 

改变源

vi /etc/apt/sources.list

apt-get update

 

 

端口使用 情况  netstat -lnp --ip

netstat -utdlp

 

ifconfig   //ip

inittab  //modify init level

startx   图形界面

rm -r -f  remove

mkdir    make directory

rmdir   remove

ls -l

touch  创建


mv    move  rename

cp  copy   -r


find  /etc -name inittab

whereis   java


echo $PATH


ln 3.txt 4  联结  -s


useradd lich

passwd lich

groupadd testuser

usermod  -g testuser lich


su lich  //switch user

chmod +x filename// chmod u+x   chmod g+x  chmod o+x

chown   //change file owner and group

wc  //word count

grep keyword filename


ctrl+c   //cancel job

lssss 2>cmd.txt  错误输出

service vsftpd start



vsftpd

vsftpd.conf  
                 anon_root=/  //access to all directory

allow root access       delete root in vsftp.user_list  vsftpd.user

[root@localhost etc]# vi vsftpd.ftpusers
[root@localhost etc]# vi vsftpd.user_list
[root@localhost etc]# vi vsftpd.user_list


vsftpd auto start 
  1.  vi /etc/rc.local  add   /usr/sbin/vsftpd 
  2.   chkconfig vsftpd on


apache  decompress

gzip -d apache-tomcat.gz
tar -xvf apr.tar

/etc/rc.local
/etc/profile


JAVA_HOME=/usr/java/jdk1.6.0_03
export JAVA_HOME

service iptables stop

rpm -qa   //all install package
rpm -e  --nodeps  //uninstall
rpm -ivh

 

 

wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
tar zxvf webbench-1.5.tar.gz
cd webbench-1.5
make && make install


  3、使用:

引用
webbench -c 500 -t 30 http://127.0.0.1/test.jpg

   参数说明:-c表示并发数,-t表示时间(秒)

  4、测试结果示例:

引用
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://127.0.0.1/test.jpg
500 clients, running 30 sec.

Speed=3230 pages/min, 11614212 bytes/sec.
Requests: 1615 susceed, 0 failed.


一、使用命令设置ubuntu的ip地址

1.修改配置文件blacklist.conf禁用IPV6:
sudo vi /etc/modprobe.d/blacklist.conf

2.在文档最后添加 blacklist ipv6,然后查看修改结果:
cat /etc/modprobe.d/blacklist.conf

3.设置IP(设置网卡eth0的IP地址和子网掩码)
sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0

4.设置网关
sudo route add default gw 192.168.2.254

5. 设置DNS 修改/etc/resolv.conf,在其中加入nameserver DNS的地址1 和 nameserver DNS的地址2 完成。

6.重启网络服务(若不行,请重启 ubuntu:sudo reboot):
sudo /etc/init.d/networking restart

7. 查看当前IP:
ifconfig

二、直接修改系统配置文件

ubuntu的网络配置文件是:/etc/network/interfaces
打开后里面可设置DHCP或手动设置静态ip。前面auto eth0,让网卡开机自动挂载。
1. 以DHCP方式配置网卡
编辑文件/etc/network/interfaces:
sudo vi /etc/network/interfaces

并用下面的行来替换有关eth0的行:
# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp

用 下面的命令使网络设置生效:
sudo /etc/init.d/networking restart

也可以在命令行下直接输入下面的命令来 获取地址
sudo dhclient eth0

2. 为网卡配置静态IP地址
编辑文件/etc/network/interfaces:
sudo vi /etc/network/interfaces

并用下面的行来替换有关eth0的行:
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.2.1
gateway 192.168.2.254
netmask 255.255.255.0
#network 192.168.2.0
#broadcast 192.168.2.255

将上面的ip地址等信息换成 你自己就可以了.用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart

3. 设定第二个IP地址(虚拟IP地址)
编辑文件/etc /network/interfaces:
sudo vi /etc/network/interfaces

在 该文件中添加如下的行:
auto eth0:1
iface eth0:1 inet static
address x.x.x.x
netmask x.x.x.x
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x

根据你的情况填上所有诸如address,netmask,network,broadcast和 gateways等信息:
用下面的命令使网络设置生效:
sudo /etc/init.d/networking restart
4. 设置主机名称(hostname)
使用下面的命令来查看当前主机的主机名称:
sudo /bin/hostname

使 用下面的命令来设置当前主机的主机名称:
sudo /bin/hostname newname

系 统启动时,它会从/etc/hostname来读取主机的名称。

5. 配置DNS
首先,你可以在/etc /hosts中加入一些主机名称和这些主机名称对应的IP地址,这是简单使用本机的静态查询。 要访问DNS 服务器来进行查询,需要设置/etc/resolv.conf文件,假设DNS服务器的IP地址是192.168.2.2, 那么/etc/resolv.conf文件的内容应为:
search chotim.com
nameserver 192.168.2.2

6.手动重启网络服务:
sudo /etc/init.d/networking restart

返回结果如下:
*Reconfiguring network interfaces… [OK]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值