假設(shè)你想在本地(本地IP:192.168.0.1)運(yùn)行192.168.0.2的X應(yīng)用程序,首先在本地xhost + 192.168.0.2,允許192.168.0.2連接本地的X Server(xhost的具體用法man xhost),然后登錄到192.168.0.2上,export DISPLAY=192.168.0.1:0。然后就可以在本地使用192.168.0.2的X應(yīng)用程序了。
使用VNC。VNC既有Linux版,也有Windows版,所以就可以互相啟動(dòng)遠(yuǎn)程桌面了。
假設(shè)在本地192.168.0.1上遠(yuǎn)程使用192.168.0.2的桌面,兩臺(tái)機(jī)器上都裝上VNC。
首先在192.168.0.2上,vncpasswd設(shè)置登錄密碼。然后啟動(dòng)vncserver(不需要root權(quán)限,每個(gè)用戶可以啟動(dòng)自己的 server),記住端口號(hào)(這兒是192.168.0.2:1)。修改$HOME/.vnc/xstartup文件,注釋掉所有行,在最后加上一行 startkde &,就可以使用KDE桌面了。當(dāng)然可以使用其它窗口管理器,默認(rèn)是twm。
在192.168.0.1上,執(zhí)行vncviewer 192.168.0.2:1,就可以了。
關(guān)閉vncserver:vncserver -kill :1 (1是display number, man vncserver)
有些軟件包是以.src.rpm結(jié)尾的,這類軟件包是包含了源代碼的rpm包,在安裝時(shí)需要進(jìn)行編譯。這類軟件包有兩種安裝方法:
方法一:
1. 執(zhí)行rpm -i your-package.src.rpm
2. cd /usr/src/redhat/SPECS
3. rpmbuild -bp your-package.specs 一個(gè)和你的軟件包同名的specs文件
4. cd /usr/src/redhat/BUILD/your-package/ 一個(gè)和你的軟件包同名的目錄
5. ./configure 這一步和編譯普通的源碼軟件一樣,可以加上參數(shù)
6. make
7. make install
方法二:
1. 執(zhí)行rpm -i you-package.src.rpm
2. cd /usr/src/redhat/SPECS (前兩步和方法一相同)
3. rpmbuild -bb your-package.specs 一個(gè)和你的軟件包同名的specs文件
用戶主頁設(shè)置
(from httpd.conf)
The name of the directory that is appended onto a user‘s home directory if a ~user request is received.
The path to the end user account ‘public_html‘ directory must be accessible to the webserver userid. This usually means that ~userid must have permissions of 711, ~userid/public_html must have permissions of 755, and documents contained therein must be world-readable. Otherwise, the client will only receive a "403 Forbidden" message.
不過首先需要將允許用戶主頁設(shè)置的UserDir選項(xiàng)打開。
連接上USB存儲(chǔ)設(shè)備后,首先執(zhí)行 fdisk -l /dev/sda,如果能看到sda1,sda2等分區(qū)的信息,則說明分區(qū)識(shí)別成功,按照普通分區(qū)mount即可;mount -o iocharset=gb2312,umask=0 /dev/sda /mnt/usb, 解決中文顯示問題,其他用戶可寫。
如果重復(fù)使用兩種USB設(shè)備,則第二個(gè)設(shè)備應(yīng)為/dev/sdb。
一次具體操作過程: (創(chuàng)建新分區(qū)和新文件系統(tǒng),并將/home掛載到該分區(qū)上)
/sbin/fdisk /dev/sda分區(qū);
/sbin/mkfs -t ext3 /dev/sda7創(chuàng)建文件系統(tǒng)(作用類似于windows下的format)
修改/etc/fstab,將/home mount到該分區(qū)上
/sbin/fdisk /dev/sdb分區(qū);
/sbin/mkfs -t ext3 /dev/sdb2創(chuàng)建文件系統(tǒng)(作用類似于windows下的format)
修改/etc/fstab,將/misc mount到該分區(qū)上
mount -t vfat /dev/hda1 /mnt/disk_c
fat32的分區(qū):mount -o codepage=936,iocharset=cp936 /dev/hda7 /mnt/cdrom
ntfs分區(qū)用上述方法可顯示部分中文,2.6內(nèi)核需要用nls=cp936參數(shù)
iso文件 :mount -o loop /abc.iso /mnt/cdrom
軟盤 :mount /dev/fd0 /mnt/floppy
USB閃存 :mount /dev/sda1 /mnt/cdrom
所有/etc/fstab內(nèi)容 mount -a
注:mount時(shí)可以指定文件格式"-t 格式", 格式可以為vfat, ext2, ext3等.
首先生成dsa的密鑰對:ssh-keygen -t dsa
輸出:
Generating public/private dsa key pair.
Enter file in which to save the key (/home/sj/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/sj/.ssh/id_dsa.
Your public key has been saved in /home/sj/.ssh/id_dsa.pub.
The key fingerprint is:
1b:8c:3d:6d:eb:e3:10:c3:b7:c0:68:a3:5f:7e:b3:51 sj@192.168.0.1
然后把其中的公鑰加入到遠(yuǎn)程機(jī)器的.ssh/authorized_keys文件中。如果authorized_keys文件不存在,直接將公鑰復(fù)制即可,比如: scp .ssh/id_dsa.pub 192.168.0.2:.ssh/authorized_keys。
還有ssh-agent的方法,暫無研究。
可以用于備份文件。
我用這個(gè)把我的主頁定期更新到服務(wù)器,如:
rsync -e ssh -av --delete ~/WiKi/publish net:~/
cron可以用來建立能夠按照指定的時(shí)間或時(shí)間間隔定期執(zhí)行的作業(yè)。所以如果你想要定期讓計(jì)算機(jī)干什么,就需要這個(gè)工具了。
每個(gè)用戶使用crontab -e的命令來編輯你自己的crontab文件,文件中每一行是一個(gè)你要運(yùn)行的作業(yè),格式如下:
minute hour dayofmonth month dayofweek command
minute: 從0到59之間的一個(gè)值
hour: 從0到23之間的一個(gè)值
dayofmonth: 從1到31之間的一個(gè)值
month: 從1到12之間的一個(gè)值
dayofweek: 從0到6之間的一個(gè)值(0表示星期天)
command: 在指定時(shí)間執(zhí)行的命令
(上面的日期和時(shí)間域中可以使用*號(hào),表示該域?yàn)閠rue)
舉例:
0 1 * * * echo "It is 1 am"
將會(huì)使得crontab的文件的所有者在每天1點(diǎn)接收到一個(gè)電子郵件,如果不想用郵件,可以把命令的輸出重定向的文件。
配置HTTP代理服務(wù)器,參考文檔。
- Starting Squid -
After you‘ve finished editing the configuration file, you can start
Squid for the first time. First, you must create the swap directories.
Do this by running Squid with the -z option:
/usr/local/squid/sbin/squid -z
Once that completes, you can start Squid and try it out. Probably the
best thing to do is run it from your terminal and watch the debugging
output. Use this command:
/usr/local/squid/sbin/squid -NCd1
If everything is working okay, then your console displays: "Ready to
serve requests".
If you want to run squid in the background, as a daemon process, just
leave off all options:
/usr/local/squid/sbin/squid
Here depending on your configuration, you may need to start squid as root.
修改系統(tǒng)時(shí)間:
date -s 11:10:00 +"%T" 或者 date --set=11:10:00 +"%T"
修改主機(jī)名:
uname可以查詢主機(jī)信息,hostname可以修改主機(jī)名;
修改/etc/sysconfig/network,將HOSTNAME一行改為HOSTNAME=主機(jī)名,重啟后也能生效;
在終端下輸入hostname <nop>YourNewHostname,也能暫時(shí)生效;但是重起后失效。
一些配置文件:
/etc/sysctl.conf:可以關(guān)閉ping等;
/etc/inittab:修改運(yùn)行級別,運(yùn)行級別3時(shí)系統(tǒng)進(jìn)入命令行模式,運(yùn)行級別5時(shí)系統(tǒng)進(jìn)入圖形化界面;
/etc/xinetd.d:修改相應(yīng)服務(wù)的disable參數(shù),可以關(guān)閉或打開相應(yīng)服務(wù);
ssh和sftp指定端口:
sftp -oPort=2000 lop
ssh -p 2000 lop
添加新的library路徑:
after modify /etc/ld.so.conf, run /sbin/ldconfig to update the dynamic loader cache.
or set environment variable: LD_LIBRARY_PATH
查看系統(tǒng)版本:
cat /proc/version to see kernel version and distribution
聯(lián)系客服