Tag Archives: linux

U盘安装rhel 5.5

今天成功在DELL Optiplex 360上安装rhel 5.5,记录如下,具体步骤不是很清晰了,所以步骤不是很详细。 下载rhel 5.5 (http://mirrors.sohu.com/RHEL/AS5U5/i386/rhel-server-5.5-i386-dvd.iso),选择适合你的版本有i386、x86_64。 使用UltraISO打开rhel-server-5.5-i386-dvd.iso里面的images/boot.iso文件。点UltraISO【启动】菜单,【写入硬盘映像…】,写入方式可以是USB-HDD或者USB-HDD+。点【写入】。boot.iso包含了我们启动所需要的两个关键文件:isolinux/vmlinuz和isolinux/initrd.img。 复制rhel-server-5.5-i386-dvd.iso到U盘根目录。 重启系统,F12(有些机器不一样)进入选择启动介质界面。选择USB device。就启动到了linux rescue模式。有多种方式供我们选择,输入linux askmethod,回车。 接下来就是选择语言,键盘布局,然后接下来是最关键是选择安装方式,有NFS/CDROME/HardDisk/FTP/HTTP。选择HardDisk。然后列出来很多分区供我们选择(/dev/sda1,/dev/sda2,/dev/sda3,/dev/sdb4),一般sda指硬盘,sdb是我们插上去的u盘。选择/dev/sdb4,就查找到u盘上的iso镜像。接下来是分区,设置密码、防火墙、SELinux、网卡配置、选择软件包等。。这些不详讲。关键一步,选择grub安装在那个地方,默认只有/dev/sdb,不能安装grub到u盘,否则u盘grub被覆盖了就完蛋鸟。选择no boot loader will be installed。等待安装完成。 安装完了,继续F12进u盘,输入chroot /mnt/sysimage,挂载root分区。 fdisk -l 查看继续上的分区情况。一般有swap,根分区,/boot分区等。假设硬盘是/dev/sda,u盘是/dev/sdb。、dev/sda1是/boot,dev/sda2是/,dev/sda3是swap。 grub-install /dev/sda grub> find /grub/stage1 (或者/boot/grub/stage1) grub> root (hd0,0) (这个是/boot分区,对应/boot,如果没有单独划分/boot分区,这里root指定/分区) grub> setup (hd0) grub> quit 这样grub就安装在硬盘上了,还需要新建一个grub菜单。 … Continue reading

Tagged | Leave a comment

tar打包排除子目录

tar zcvf backup.tar.gz site/* –exclude=site/attach –exclude=site/images

Tagged | Leave a comment

liunx 定时ntp校正时间 [root@localhost ~]# rpm -q ntp    //是否存在ntp时间服务器 ,一般安装liunx自动安装上 ntp-4.2.2p1-9.el5_4.1   [root@localhost ~]# vi updatetime.sh #!/bin/sh server="ntp.sjtu.edu.cn" /usr/sbin/ntpdate -s $server /usr/sbin/hwclock –systohc Exit [root@localhost ~]# chmod 755 updatetime.sh [root@localhost ~]# crontab -u root -e 0,30 * * * * … Continue reading

Posted on by tunpishuang | Leave a comment

Linux环境下查看服务器硬件信息

查看CPU型号 cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 16  Intel(R) Xeon(R) CPU           X5560  @ 2.80GHz 查看物理CPU个数 cat /proc/cpuinfo | grep physical | uniq -c 1 physical id     : 1 1 physical id     : 0 查看CPU运行模式:32位或者64位,如果是32位的话并不代表不能运行在64位下 … Continue reading

Tagged | Leave a comment

linux简单tcp通讯

server: #include <sys/socket.h>#include <stdio.h>#include <netdb.h>#include <errno.h>#include <string.h>#include <stdlib.h>#include <netinet/in.h>#include <sys/types.h> #define portnum 3456 int main(int argc,char *argv[]){    int s_fd,c_fd;    char buffer[1024];    struct sockaddr_in server_addr;//服务器ip地址    struct sockaddr_in client_addr;//客户端ip地址    int nbytes;    int cli_size;    /*    struct sockaddr_in    {        short int sin_family; //ip地址族        unsigned short int sin_port; //端口号        struct in_addr sin_addr;  //ip地址        unsigned char sin_zero[8]; //填0    }    */    /*    struct in_addr    {        unsigned long s_addr;    }    */    s_fd=socket(AF_INET,SOCK_STREAM,0);    //地址描述,套接口类型,套接口所用的协议    if(s_fd==-1)    {        fprintf(stderr,”Socket … Continue reading

Tagged , | Leave a comment

gcc -g选项:生成调试符号信息

-g Produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF 2). GDB can work with this debugging information. -g选项产生本地系统调试信息格式(比如:stabs,COFF,XCOFF,或者DWARF 2)。gdb调试的时候需要这些调试符号信息。 On most systems that use stabs format, -g enables use of extra debugging information that … Continue reading

Tagged , , | Leave a comment

linux编程:warning incompatible implicit declaration of built-in function ‘printf’

请确认调用printf函数的文件引用了头文件 #include <stdio.h>

Tagged , | Leave a comment

linux编程错误 error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{‘ token

error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{‘ token 请确认函数声明最后有分号(;)

Tagged , | Leave a comment

Linux内核中的PAE意义

经常看内核名字的时候会发现带上PAE字样,查了一下,原来是:Physical Address Extensions 操作系统在32bit x86平台上最大寻址空间只有4GB,如果要使用大于4GB的内存,就必须使用Intel的PAE(物理地址扩展)模式。在Windows NT平台实现PAE只需要对boot.ini加上/pae即可。而对于RHEL5,缺省安装模式下是不允许检测超过4GB内存,所以我们需要在内核安装完 毕后再安装kernel-PAE套件。 如果是装的i386系统并且内存大于2G,装的kernel上就会带上PAE的字样,64位的系统就不会这样。 今天装驱动的时候需要装kernel-devel,直接yum install kernel-devel后还是不行,看了一下内核是带PAE的,这时候要安装kernel-PAE-devel。 搞定。 via

Tagged | 1 Comment

apt-get限速

先安装wondershaper: # apt-get install wondershaper 限制上、下行带宽(单位Kb): # wondershaper eth0 8192 8192 取消限制: # wondershaper clear eth0 注意这里控制流量的单位是Kb(Kilobit),而不是KB(Kilobyte)。如上面这个例子中的8192就表示限制速度为1024KB也就是1MB。 如果有兴趣,可以vi /usr/sbin/wondershaper 看看这个shell用的程序是tc。

Tagged , | Leave a comment