网卡配置
/etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE=eth0 #网卡设备名称
- ONBOOT=yes #启动时是否激活 yes|no
- BOOTPROTO=static #协议类型 dhcp bootp none
- IPADDR=192.168.1.90 #网络IP地址
- NETMASK=255.255.255.0 #网络子网地址
- GATEWAY=192.168.1.1 #网关地址
- BROADCAST=192.168.1.255 #广播地址
- HWADDR=00:0C:29:FE:1A:09#网卡MAC地址
- TYPE=Ethernet #网卡类型为以太网
DNS
/etc/resolv.conf
- servername 8.8.8.8
- servername 8.8.4.4
启用network服务
- service network restart
查看IP地址:
ifconfig eth0 列出全面
ifconfig | grep ‘Bcast' 直观
安装一个下载工具 wget
wget是一个从网络上自动下载文件的自由工具,支持通过HTTP、HTTPS、FTP三个最常见的TCP/IP协议下载,并可以使用HTTP代理。
yum install wget
安装163的源
备份原源文件 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
yum makecache
为了学习方便这里暂时先禁用SELINUX和iptables
修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启。
[root@mail ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@mail ~]# service ip6tables stop
ip6tables: Setting chains to policy ACCEPT: filter [ OK ]
ip6tables: Flushing firewall rules: [ OK ]
ip6tables: Unloading modules: [ OK ]
[root@mail ~]# chkconfig iptables off
[root@mail ~]# chkconfig ip6tables off
升级一下系统 yum -y update
yum -y upgrade 升级所有包,不改变软件设置和系统设置,系统版本升级,内核不改变
yum -y update 升级所有包,改变软件设置和系统设置,系统版本内核都升级
配置ssh
- Port 22
- ListenAddress 0.0.0.0
- Protocol 2
- PermitRootLogin yes
- PermitEmptyPasswords no
- PasswordAuthentication yes
命令行窗口大小调整:
/boot/grub/grub.conf
在kernel一行添加如下命令
nomodeset vga=792 (在 KEYTABLE=us后添加)
保存,重启,问题解决。
- # grub.conf generated by anaconda
- #
- # Note that you do not have to rerun grub after making changes to this file
- # NOTICE: You have a /boot partition. This means that
- # all kernel and initrd paths are relative to /boot/, eg.
- # root (hd0,0)
- # kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
- # initrd /initrd-[generic-]version.img
- #boot=/dev/sda
- default=0
- timeout=5
- splashimage=(hd0,0)/grub/splash.xpm.gz
- hiddenmenu
- title CentOS (2.6.32-431.3.1.el6.x86_64)
- root (hd0,0)
- kernel /vmlinuz-2.6.32-431.3.1.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=pc KEYTABLE=us nomodeset vga=792 rd_NO_DM rhgb quiet
- initrd /initramfs-2.6.32-431.3.1.el6.x86_64.img
- title CentOS (2.6.32-431.el6.x86_64)
- root (hd0,0)
- @
- "/boot/grub/grub.conf" 21L, 1222C
<pre name="code" class="answer-text mb-10" id="answer-content-845254195" style=""><table style="text-align:left; color:rgb(0,0,0); line-height:26px; font-family:Arial; font-size:9px" align="left" border="1" cellspacing="0"><tbody><tr><td><strong><span style="font-size:18px;">Depth</span></strong></td><td><strong><span style="font-size:18px;">800×600</span></strong></td><td><strong><span style="font-size:18px;">1024×768</span></strong></td><td><strong><span style="font-size:18px;">1152×864</span></strong></td><td><strong><span style="font-size:18px;">1280×1024</span></strong></td><td><strong><span style="font-size:18px;">1600×1200</span></strong></td></tr><tr><td align="center"><span style="font-size:18px;">8 bit</span></td><td align="center"><span style="font-size:18px;">vga=771</span></td><td align="center"><span style="font-size:18px;">vga=773</span></td><td align="center"><span style="font-size:18px;">vga=353</span></td><td align="center"><span style="font-size:18px;">vga=775</span></td><td align="center"><span style="font-size:18px;">vga=796</span></td></tr><tr><td align="center"><span style="font-size:18px;">16 bit</span></td><td align="center"><span style="font-size:18px;">vga=788</span></td><td align="center"><span style="font-size:18px;">vga=791</span></td><td align="center"><span style="font-size:18px;">vga=355</span></td><td align="center"><span style="font-size:18px;">vga=794</span></td><td align="center"><span style="font-size:18px;">vga=798</span></td></tr><tr><td align="center"><span style="font-size:18px;">24 bit</span></td><td align="center"><span style="font-size:18px;">vga=789</span></td><td align="center"><span style="font-size:18px;">vga=792</span></td><td align="center"><span style="font-size:18px;"></span></td><td align="center"><span style="font-size:18px;">vga=795</span></td><td align="center"><span style="font-size:18px;">vga=799</span></td></tr></tbody></table>
挂载U盘
可以先创建挂载点: mkdir /mnt/udisk
插入U盘,write through.....
mount /dev/sdb4 /mnt/udisk
卸载
umount /mnt/udisk
正确的操作时避免U盘使用出错的关键:
插入U盘,查询盘,挂载盘,使用,取消挂载,拔出U盘
tar的使用
tar -zxvf rarlinux-4.0.1.tar.gz NOTE:
分页显示信息
ls | more 又如 tar --help | more 其他命令用法相同。 ls可替换为其他命令
shell> vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=lxjserver
同时也修改下
shell> vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 lxjserver
192.168.1.200 lxjserver
192.168.1.200 localhost
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
安装wordpress 后 应用主题或者安装插件时出现 FTP账号的密码 是因为 网站所在目录权限访问导致:
nginx
修改:
chown www.www /usr/local/nginx/html/ -R #设置目录所有者
chmod 700 /usr/local/nginx/html/ -R #设置目录权限
shutdown -r now #重启
apache修改
chown apache.apache /var/local/wwwhtml/ -R #设置目录所有者
chmod 700 /varlocal/www/html/ -R #设置目录权限
shutdown -r now #重启
可以使用 ps -aux 查看 httpd 或nginx的用户。来确认具体修改网站目录的属主
在数据库MySQL中建立
wordpress
创建MySQL数据库
mysql - u root -p #进入mysql控制台,提示输入MySQL的root密码
mysql> create database wordpress;
exit; #退出 或 \q
①CREATE DATABASE 数据库名;
②GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON 数据库名.* TO 数据库名@localhost IDENTIFIED BY '密码';
③SET PASSWORD FOR '数据库名'@'localhost' = OLD_PASSWORD('密码');
依次执行3个命令完成数据库创建。注意:中文 “密码”和“数据库”是户自己需要设置的。