centosbz2解压
‘壹’ 如何 在centos系统下安装 7-zip 并解压.7z 文件
执行以下命令下载安装:
wget http://nchc.dl.sourceforge.net/project/p7zip/p7zip/9.20.1/p7zip_9.20.1_src_all.tar.bz2
tar -jxvf p7zip_9.20.1_src_all.tar.bz2
cd p7zip_9.20.1
make
make install
最后一步make install后出现以下信息,即为安装完毕。
./install.sh /usr/local/bin /usr/local/lib/p7zip /usr/local/man /usr/local/share/doc/p7zip
- installing /usr/local/bin/7za
- installing /usr/local/man/man1/7z.1
- installing /usr/local/man/man1/7za.1
- installing /usr/local/man/man1/7zr.1
- installing /usr/local/share/doc/p7zip/README
- installing /usr/local/share/doc/p7zip/ChangeLog
- installing HTML help in /usr/local/share/doc/p7zip/DOCS
‘贰’ CentOS绯荤粺涓嬭蒋浠跺寘镄勫埗浣沧柟娉曞拰杩囩▼
镐荤殑𨱍呭喌涓婰inux涓嬭蒋浠跺畨瑁呬富瑕佹湁涓夌嶆柟寮忥细
涓绉嶆槸婧愮爜瀹夎咃纴闇瑕佺敤鎴疯嚜宸辨坠锷ㄧ紪璇
鍙︿竴绉嶆槸RPM鍖(RedHat linux Packet Manager),阃氲繃RPM锻戒护灏卞彲浠ュ疄鐜板畨瑁
杩樻湁涓绉崭负*.bin鏂囦欢锛屽畨瑁呮柟娉曚笌Windows涓嬬殑瀹夎呰繃绋嬬被浼
阃氩父𨱍呭喌涓婰inux 瀹夎呰蒋浠朵富瑕侀氲繃浠ヤ笅涓ょ嶆柟寮
鈶 鏂囦欢钖嶅舰濡倄xx.i386.rpm ,杞浠跺寘浠ヤ簩杩涘埗褰㈠纺鍙戝竷.
鈶 鏂囦欢钖嶅舰濡倄xx.tar.gz ,杞浠跺寘澶氢互婧愮爜镄勫舰寮忓彂甯.
Linux杞浠跺寘绠$悊鍙浠ュ垎涓轰笁绫伙细浜岃繘鍒跺寘镄勭$悊锛屾簮浠g爜鍖呯殑绠$悊锛岃剼链瀹夎
鍙﹀栧煎缑娉ㄦ剰镄勬槸鐩鍓嶅瓨鍦ㄥ悇绉峀inux镄勫彂琛岀増銮峰彇鍜屽畨瑁呰蒋浠剁殑鏂瑰纺涔熸湁寰埚氢緥濡
銆愩憆edhat/centos镄剏um瀹夎(链変笓闂ㄧ殑闀滃儚婧)
銆愩慤buntu/Fedora/Debian镄剆udo apt-get阃傜敤浜巇eb鍖呰繘琛岀$悊瀹夎
銆愩戜篃链夌殑杞浠舵槸阃氲繃鍒荤洏锷犲瘑镄勫舰寮忕劧钖庤繘琛屽畨瑁呯殑(渚嫔俢nyunwei)
銆愩戝湪绯荤粺杩愮淮绠$悊浜哄憳鏂归溃涔熸湁阃氲繃ssh銆丆/C++璇瑷鎴栬卲y镓ц岀殑涓浜涜蒋浠跺懡浠よ繘琛岃嚜锷ㄥ寲绠$悊镄勫簲鐢锛岃繖閲屽氨涓嶅仛璇︾粏浠嬬粛浜嗐
涓嬮溃链変竴寮犲浘鍙浠ユ竻鏅板湴琛ㄧずlinux杞浠跺簲鐢ㄧ殑鏋舵瀯鍏崇郴锛
銆銆鍦↙inux钖锷ㄧ殑镞跺欍傞栧厛浼氩惎锷ㄥ唴镙(kernel)锛屽唴镙告槸涓娈佃$畻链虹▼搴忥纴杩欎釜绋嫔簭鐩存帴绠$悊绠$悊纭浠讹纴鍖呮嫭CPU銆佸唴瀛樼┖闂淬佺‖鐩樻帴鍙c佺绣缁沧帴鍙g瓑绛夈傛墍链夌殑璁$畻链烘搷浣滈兘瑕侀氲繃鍐呮牳浼犻掔粰纭浠躲傛垜浠鍙浠ョ湅鍒帮纴Linux鍒╃敤kernel瀹炵幇杞纭浠剁殑瀵硅瘽銆傞氲繃绯荤粺璋幂敤镄勮繖涓閲嶈佺殑鎺ュ彛锛孡inux灏嗕笂灞傜殑搴旂敤涓庝笅灞傜殑kernel瀹屽叏鍒嗙诲紑锛屼负绋嫔簭锻橀殣钘忎简搴曞眰镄勫嶆潅镐(鐩稿簲镄勶纴涔熸彁楂树简涓婂眰搴旂敤镄勫彲绉绘嶆)銆傚綋鎴戜滑鍦ㄥ崌绾kernel镄勬椂鍊欙纴涔熷彲浠ヤ缭鎸佺郴缁熻皟鐢ㄧ殑璇鍙ヤ笉鍙桡纴浠庤岃╀笂灞傚簲鐢ㄤ笉镒熷弹鍒颁笅灞傜殑鏀瑰彉銆傚簱鍑芥暟鍒╃敤绯荤粺璋幂敤鍒涢犲嚭妯″潡鍖栫殑锷熻兘锛岃宻hell鍒欐彁渚涗简涓涓鐢ㄦ埛鐣岄溃锛屽苟璁╂垜浠鍙浠ュ埄鐢╯hell镄勮娉旷紪鍐栾剼链锛屼互鏁村悎绋嫔簭銆傛湁浜呜繖浜涙濇兂鎴戜滑鍙浠ュ揩阃熷湴浜呜Вlinux镄勮蒋浠跺簲鐢ㄧ殑瀹夎呭拰宸ヤ綔铡熺悊锛屼篃锲犳や负浜嗘柟渚垮拰銮峰彇镟村氢紒涓氩簲鐢ㄦ垜浠闇瑕佸湪linux绯荤粺涓婂紑鍙戝苟涓旈氲繃婧愮爜缂栬疟镄勬柟寮忓埗浣滃悇绉嶈蒋浠跺寘浠庤屼负淇℃伅鍖栨椂浠f湇锷°
链鏂囦富瑕佷粙缁嶆簮镰佸畨瑁呬笌RPM鍖呯殑瀹夎
婧愮爜鍖呭拰鍟嗕笟杞浠跺寘镙规嵁钖勪釜鍏鍙告垨浣滆呯殑瀹为檯𨱍呭喌鍑哄彂(鍙浠ユ槸tar绛夋牸寮忕殑铡嬬缉鍖咃纴涔熷彲浠ユ槸bin镄勬簮绋嫔簭锛屽彲浠ユ槸宸茬粡缂栬疟濂戒简镄勭洿鎺ユ嬁𨱒ヨ繍琛岀殑鏂囦欢锛屼篃鍙浠ユ槸鍏夌洏铏氭嫙鍖栨枃浠剁瓑鍏朵粬浠嬭川𨱒ュ埗浣滃彂甯幂殑iso鏂囦欢绛)灏佽呮垚涓绉岖壒瀹氱殑镙煎纺鍙戝竷浠庤岃繘琛岀浉搴旂殑杞浠舵湇锷°傚叾瀹为氲繃yum鎴栬卪ake install锻戒护瀹夎呯殑杞浠跺湪绯荤粺閮戒细镊锷ㄧ敓鎴恟pm鍖(鍙鏄鍙傛暟鍜屽姛鑳芥ā鍧楀樊寮傚拰涓ヨ皑镄)
绠浠:
RPM(RedHat Package Manager,绾㈠附瀛愯蒋浠跺寘绠$悊鍣)鐢ㄤ簬杞浠跺寘镄勫畨瑁呫佹煡璇銆佸崌绾с佹牎楠屻佸嵏杞斤纴浠ュ强鐢熸垚.rpm镙煎纺镄勮蒋浠跺寘 RPM镄勪娇鐢ㄥ墠
鎸傝浇linux绯荤粺(centos4涓轰緥)镄勫畨瑁呭厜鐩,褰撶劧涔熷彲鍦ㄧ绣涓娄笅杞藉厤璐圭殑RPM鍖.
# mount/dev/cdrom ---鎸傝浇鍏夌洏
# cd/media/cdrom/CentOS/RPMS ---杩涘叆鍏夌洏涓璕PM鍖呯殑鐩褰(鍙浠ラ氲繃#mount锻戒护𨱒ユ煡鐪嫔厜鐩樼殑鎸傝浇镣逛竴鑸浼氩湪链钖庝竴琛屾樉绀)
# ls
涓銆佹簮镰佸寘瀹夎
1銆*.src.rpm褰㈠纺镄勬簮浠g爜杞浠跺寘
鐢ㄦ硶锛
瀹夎咃细 rpm 钬搑ebuild *.src.rpm
cd /usr/src/dist/RPMS
Rpm 钬搃vh *.rpm
鍗歌浇锛 rpm 钬揺 packagename
2銆.tar.gz锛*.tgz锛*.bz2褰㈠纺杞浠跺寘镄勫畨瑁
棣栧厛杩涜岃В铡,锻戒护濡备笅
tar zxvf *.tar.gz
tar xvfz *.tgz
tar xvfj *.tar.bz2
瑙e帇涔嫔悗杩涘叆瑙e帇鐩褰曪纴铹跺悗杩涜屼互涓嬫搷浣(涓鑸𨱍呭喌锛屽叿浣撶湅杞浠跺寘镄勬枃浠跺悕)
閰岖疆锛./configure
缂栬疟锛歮ake
瀹夎咃细make install
鍗歌浇锛歮ake uninstall
婧愮爜瀹夎呮湁涓瀹氱殑闅惧害锛屼笉钖岀殑杞浠跺彲鑳芥湁涓嶅悓镄勫畨瑁咃纴涓鑸鍦ㄨВ铡嬩箣钖庡簲璇ュ厛阒呰昏存槑鏂囨。锛屾寜镦ц存槑杩涜屽畨瑁咃纴涓婇溃璇寸殑鍙鏄涓鑸𨱍呭喌銆
浜屻丷PM鍖呭畨瑁
RPM瀹夎呭寘镙煎纺鏄鐢卢edhat鍏鍙告彁鍑虹殑锛屽ぇ澶х殑绠鍖栦简Linux涓嬭蒋浠剁殑瀹夎咃纴棣栧厛浠嬬粛涓涓嬮氱敤阃夐”銆
-v锛氭樉绀洪梼锷犱俊鎭
-vv锛氭樉绀鸿皟璇曚俊鎭
--root directory锛氲㏑PM浠directory浣滀负镙圭洰褰曪纴杩欐牱棰勫畨瑁呯▼搴忓拰钖庡畨瑁呯▼搴忛兘浼氩畨瑁呭埌杩欎釜鐩褰曚笅銆
1銆佸畨瑁咃细rpm 钬搃 file.rpm
Options:
h锛氩畨瑁呮椂杈揿嚭hash璁板彿
test锛氩彧瀵瑰畨瑁呰繘琛屾祴璇曪纴涓岖湡姝e畨瑁
--persent锛氢互锏惧垎姣斿舰寮忔樉绀哄畨瑁呰繘搴
--excludedocs锛氢笉瀹夎呰蒋浠跺寘涓镄勬枃妗
--replacepkgs锛氩己鍒堕吨鏂板畨瑁
--replacefiles锛氭浛鎹㈠睘浜庡叾瀹冭蒋浠跺寘镄勬枃浠
--force锛氩拷鐣ヨ蒋浠跺寘鍙婃枃妗e啿绐
--ignorearch锛氢笉镙¢獙杞浠跺寘缁撴瀯
--ignoreos锛氢笉妫镆ヨ蒋浠跺寘杩愯岀殑镎崭綔绯荤粺
--nodeps锛氢笉妫镆ヤ緷璧栨у叧绯
--noscripts锛氢笉杩愯岄勫畨瑁呭拰钖庡畨瑁呰剼链绋嫔簭
2銆佸垹闄ゃrpm 钬揺 pkgname
Option:
--test锛氩彧锅氩垹闄ゆ祴璇曪纴涓岖湡姝e垹闄
--noscripts锛氢笉杩愯岄勫畨瑁呭拰钖庡畨瑁呰剼链绋嫔簭
--nodeps锛氢笉妫镆ヤ緷璧栨
娉ㄦ剰锛歱kgname鏄杞浠跺寘镄勫悕瀛楋纴涓嶆槸rpm鍖呭悕瀛楋纴钥屾槸瀹夎呭悗杞浠跺寘镄勫悕瀛楋纴鍙浠ョ敤镆ヨ㈠懡浠ゆ潵镆ヨ㈣蒋浠跺寘钖嶃
3銆佸崌绾сrpm钬揢(鎴栬呪攗pgrade) file.rpm
Option锛
锘烘湰涓庡畨瑁呮椂镄刼ption涓镙凤纴链夊嚑涓鐗规畩镄勶细
--oldpackage锛氩厑璁镐竴涓镞х増链
4銆佹煡璇銆rpm 钬搎(鎴栬--query)
Option:
-p PACKAGE_FILE锛氭煡璇㈣蒋浠跺寘镄勬枃浠
-f FIEL锛氭煡璇FILE灞炰簬鍝涓杞浠跺寘
-a锛氭煡璇㈡墍链夊畨瑁呯殑杞浠跺寘
-g銆group锛氭煡璇㈠睘浜巊roup缁勭殑杞浠跺寘
--whatproVidesCAPABILITY锛氭煡璇㈡彁渚涗简CAPABILITY锷熻兘镄勮蒋浠跺寘
--whatrequiresCAPABILITY锛氭煡璇㈡墍链夐渶瑕丆APABILITY锷熻兘镄勮蒋浠跺寘
-i锛氭樉绀鸿蒋浠跺寘镄勬傝佷俊鎭
-l锛氭樉绀鸿蒋浠跺寘涓镄勬枃浠跺垪琛
-c锛氭樉绀洪厤缃鏂囦欢鍒楄〃
-s锛氭樉绀烘枃浠跺垪琛
-scripts锛氭樉绀哄畨瑁呫佸嵏杞斤纴镙¢獙鑴氭湰
--qf锛氢互鐢ㄦ埛鎸囧畾镄勬柟寮忔煡璇
--mp锛氭樉绀烘疮涓鏂囦欢镄勬牎楠屼俊鎭
--proVides锛氭樉绀鸿蒋浠跺寘鎻愪緵镄勫姛鑳
-R锛氭樉绀鸿蒋浠跺寘闇瑕佺殑锷熻兘
5銆佹牎楠屽凡缁忓畨瑁呯殑杞浠跺寘 rpm 钬揤(or 钬捣erify,or 钬搚)
Option阃夐”涓庡叾瀹冨懡浠ょ殑绫讳技
6銆佹牎楠岃蒋浠跺寘涓镄勬枃浠 rpm 钬揔(or 钬揷hecksig) file.rpm
Option:
-v锛氭樉绀虹増链淇℃伅
-vv锛氭樉绀鸿皟璇曚俊鎭
--rcfile銆FILELIST锛氲剧疆rpmrc 鏂囦欢涓篎ILELIST
7銆佸叾瀹僐PM阃夐”
--rebuilddb锛氶吨寤篟PM璧勬枡搴
--initdb锛氩垱寤轰竴涓鏂扮殑RPM璧勬枡搴
--quiet锛氩敖鍙鑳藉湴鍑忓皯杈揿嚭
--help锛氭樉绀哄府锷╂枃浠
--version锛氭樉绀篟PM褰揿墠鐗堟湰
涓婇溃鍙鏄瀵瑰父鐢ㄩ夐”镄勬荤粨锛屽叿浣撹缮链変粈涔堥梾棰桡纴鍙浠ョ敤man rpm锻戒护杩涜屾煡鐪嬶纴瀹樻柟鏂囦欢姘歌繙链濂界殑钥佸笀銆
涓夈*.bin镙煎纺瀹夎呮枃浠剁殑瀹夎
鍙闇鍙屽嚮鎴栧崟鍑*.bin鏂囦欢灏卞彲浠ユ牴鎹鎻愮ず瀹夎呬简锛屼笉鍐嶆暦杩般
瑕佹兂鍒朵綔涓涓猂PM镙煎纺镄勮蒋浠跺寘,闇瑕佺紪鍐栾蒋浠跺寘鎻忚堪鏂囦欢銆傚叾镙囧嗳锻藉悕镙煎纺涓:杞浠跺悕-鐗堟湰鍙-閲婂嚭鍙.spec(鐜板湪澶у氭儏鍐典笅閮芥槸鐩存帴鐢锛氲蒋浠跺悕.spec)锛岃繖涓鏂囦欢,璇︾粏鎻忚堪浜嗘湁鍏宠ヨ蒋浠跺寘镄勮稿氢俊鎭,濡傝蒋浠跺悕,鐗堟湰,绫诲埆,璇存槑鎽樿,鍒涘缓镞惰佹墽琛屼粈涔堟寚浠,瀹夎呮椂瑕佹墽琛屼粈涔堟搷浣,浠ュ强杞浠 鍖呮墍瑕佸寘钖镄勬枃浠剁瓑绛夈傛湁浜呜繖涓鏂囦欢,RPM灏卞彲浠ュ埗浣滃嚭鐩稿簲镄勫寘瑁规枃浠舵潵銆傚綋铹剁幇鍦ㄤ篃链変緥濡係ource rpm杩欐牱寮婧愮殑鍖呭埗浣滆緟锷╁伐鍏峰彧瑕佷竴涓绋嫔簭婧愬嵆鍙阃氲繃钖戝间笅涓姝ュ嵆鍙鍒朵綔銆
绠鍗旷殑涓涓鍒朵綔渚嫔瓙锛
鍏跺疄链濂界殑锷炴硶鏄锅氢釜杞浠跺寘銆傛垜璁板缑 rpm 鍜 debian 閮芥湁蹇阃熸墦鍖呯殑寮婧愯蒋浠跺彲浠ョ洿鎺ユ嬁𨱒ヤ娇鐢ㄥ嵆鍙銆
eg灏唍ginx镄则ar鍖呭埗浣滀负RPM鍖
1. 涓嬭浇nginx镄勬簮镰佸寘
2. 灏嗘枃浠舵斁鍒/usr/src/redhat/SOURCES/鐩褰曚笅
3. 缂栧啓SPEC鏂囦欢
[root@mail SPECS]# vinginx-0.8.35.spec
Summary:the first rpmpackage
Name:nginx
Version:0.8
Release:35
Vendor:[email protected]
License:Share
Group:Applications/Text
Source0:nginx-0.8.35.tar.gz
%description
my test nginx
%prep
tar -zxvf $RPM_SOURCES_DIR/nginx-0.8.35.tar.gz
%build
cd$RPM_BUILD_DIR/nginx-0.8.35
./configure
make
%install
cd$RPM_BUILD_DIR/nginx-0.8.35
make install
%clean
rm -rf$RPM_BUILD_DIR/nginx-0.8.35
%files
%defattr(-,root,root)
/usr/local/nginx/sbin/nginx
%doc $RPM_BUILD_DIR/nginx-0.8.35/README
4. 鍒朵綔RPM鍖
[root@mail SPECS]#rpmbuild -ba nginx-0.8.35.spec
鑻ヨ繍琛屾病链夐敊璇锛屽垯浜х敓/usr/src/redhat/RPMS/i386/nginx-0.8-35.i386.rpm鍜/usr/src/redhat/SRPMS/nginx-0.8-35.src.rpm 涓や釜鏂囦欢銆
镐荤粨锛歳pm鍖呭备綍鍒朵綔涔嬩釜浜虹粡楠
涓 RPM浠嬬粛
RPM 鍓嶆槸RedHat Package Manager 镄勭缉鍐欙纴链镒忔槸Red Hat 杞浠跺寘绠$悊锛岄【钖嶆濅箟鏄疪ed Hat 璐$尞鍑烘潵镄勮蒋浠跺寘绠$悊;鐜板湪搴斾负RPM Package Manager镄勭缉鍐欍傚湪Fedora 銆丷edhat銆丮andriva銆丼uSE銆乊ellowDog绛変富娴佸彂琛岀増链锛屼互鍙婂湪杩欎簺鐗堟湰锘虹涓娄簩娆″紑鍙戝嚭𨱒ョ殑鍙戣岀増閲囩敤; RPM鍖呬腑闄や简鍖呮嫭绋嫔簭杩愯屾椂镓闇瑕佺殑鏂囦欢锛屼篃链夊叾瀹幂殑鏂囦欢;涓涓猂PM 鍖呬腑镄勫簲鐢ㄧ▼搴忥纴链夋椂闄や简镊韬镓甯︾殑闄勫姞鏂囦欢淇濊瘉鍏舵e父浠ュ栵纴杩橀渶瑕佸叾瀹幂壒瀹氱増链鏂囦欢锛岃繖灏辨槸杞浠跺寘镄勪緷璧栧叧绯汇
RPM鍙浠ヨ╃敤鎴风洿鎺ヤ互binary鏂瑰纺瀹夎呰蒋浠跺寘锛屽苟涓斿彲镟跨敤鎴锋煡璇㈡槸钖﹀凡缁忓畨瑁呬简链夊叧镄勫簱鏂囦欢;鍦ㄧ敤RPM鍒犻櫎绋嫔簭镞讹纴瀹冨张浼氲仾鏄庡湴璇㈤梾鐢ㄦ埛鏄钖﹁佸垹闄ゆ湁鍏崇殑绋嫔簭銆傚傛灉浣跨敤RPM𨱒ュ崌绾ц蒋浠讹纴RPM浼氢缭鐣椤师鍏堢殑閰岖疆鏂囦欢锛岃繖镙风敤鎴峰氨涓岖敤閲嶆柊閰岖疆鏂扮殑杞浠朵简銆俣PM淇濈暀涓涓鏁版嵁搴掳纴杩欎釜鏁版嵁搴扑腑鍖呭惈浜嗘墍链夌殑杞浠跺寘镄勮祫鏂欙纴阃氲繃杩欎釜鏁版嵁搴掳纴鐢ㄦ埛鍙浠ヨ繘琛岃蒋浠跺寘镄勬煡璇銆俣PM铏界劧鏄涓篖inux钥岃捐$殑锛屼絾鏄瀹冨凡缁忕Щ鍊煎埌SunOS銆丼olaris銆丄IX銆両rix绛夊叾瀹僓NIX绯荤粺涓娄简銆俣PM阆靛惊GPL鐗堟潈鍗忚锛岀敤鎴峰彲浠ュ湪绗﹀悎GPL鍗忚镄勬浔浠朵笅镊鐢变娇鐢ㄥ强浼犳挱RPM銆
浜 RPM鍖呭垎绫
鎴戜釜浜鸿や负rpm鍒嗕负涓ゅぇ绫伙纴
1 浜岃繘鍒剁被鍖咃纴鍖呮嫭rpm瀹夎呭寘(涓鑸鍒嗕负i386鍜寈86绛夊嚑绉)鍜岃皟寮忎俊鎭鍖呯瓑銆
2 婧愮爜绫诲寘锛屾簮镰佸寘鍜屽紑鍙戝寘搴旇ュ綊浣嶆ょ被銆
瀹冧滑涔嬮棿镄勫叧绯绘槸锛屾渶鍏堟垜浠鎸塺pm镓揿寘瑕佹眰鏀归犺蒋浠堕”鐩婧愮爜锛屽綋绗﹀悎瑕佹眰涔嫔悗灏卞彲浠ヤ娇鐢╮pmbuild锻戒护𨱒ョ敓鎴愪笉钖岀殑rpm鍖咃纴钖屾椂鐢熸垚镄勫寘涔嬮棿鐗堟湰鏄鐩存帴瀵瑰簲镄勶纴姣斿傜浉钖岀殑婧愮爜鍖呭皢鐢熸垚瀹屽叏鐩稿悓镄勪簩杩涘埗rpm鍖呫傚綋浣犲湪缃戜笂镆ユ垒rpm鍖呮椂锛屼竴鑸浣犲彲浠ュ湪RPMS鐩褰曚腑镓惧埌棰勭紪璇戠殑浜岃繘鍒跺寘锛岃屾簮镰佸寘鍒欎细鍦⊿RPMS鐩褰曞唴銆
鎴戜滑杩欓噷鎻愬埌镄凴PM鍒朵綔灏辨槸鎸囨敼阃犺蒋浠舵簮浠g爜浣夸箣绗﹀悎RPM镓揿寘瑕佹眰镄勮繃绋嬶纴杩欎篃鍙浠ョ瓑浠蜂负RPM婧愮爜鍖呯殑鍒朵綔杩囩▼锛屽洜涓哄綋浣犳湁浜嗘簮镰佸寘灏卞彲浠ョ洿鎺ョ紪璇戝缑鍒颁簩杩涘埗瀹夎呭寘鍜屽叾浠栦换镒忓寘銆
涓 RPM鍖呭埗浣滀粙缁
RPM鍖呯殑鍒朵綔锛屽嵆鏄疪PM婧愮爜鍖呯殑鍒朵綔銆
杩欓噷鎴戞兂璇磋碦PM鍖呭伐浣灭殑铡熺悊锛岃繖灏嗘湁锷╀簬鍏ㄩ溃镄勪简瑙RPM鍖呯$悊绯荤粺镄勭煡璇嗐
RPM鏄涓鸿В鍐虫簮镰佸寘涓嶆槗瀹夎(闇瑕佺紪璇)鍜岃蒋浠跺寘鐩镐簰涔嬮棿渚濊禆(鏄疪PM鍖呯$悊鍣ㄥ彲浠ヤ竴瀹氱▼搴﹁В鍐充緷璧栭梾棰)闂棰桡纴瀹冮氲繃鍦ㄦ帰娴嬫簮镰佸寘鍦╞uild鍜宨nstall阒舵电殑锷ㄤ綔銮峰缑链缁堢敓鎴愮殑闇瑕佸畨瑁呯殑绯荤粺閲岀殑鏂囦欢锛屽苟璁板綍涓嬩竴浜涘繀瑕佺殑镎崭綔(姣斿傚畨瑁呭畬鎴愬悗镓ц屾煇椤规搷浣)锛岀劧钖庢妸姝ょ粍鎴愪负涓涓鏁翠綋锛屽綋鍦ㄧ敤鎴峰畨瑁呮ゅ寘镞舵妸鍓嶉溃銮峰缑镄勬墍链夐梾棰桦拰璁板綍镄勬墍链夋搷浣滃师铡熸湰链镄勪綔鐢ㄧ殑瀹为檯绯荤粺涓娿
涓轰竴涓鏅阃氱殑婧愮爜镓揜PM鍖咃纴闇瑕佷笅闱涓浜涙搷浣滐纴棣栧厛闇瑕佸归”鐩镄凪akefile浣滃繀瑕佺殑鏀归犱互鏀鎸丷PM镓揿寘镎崭綔(瀹为檯涓婃ゆ搷浣滀笉鏄缁濆圭殑锛孲PEC鏂囨。鍜孧akefile镄勬槸鍗忚皟缁熶竴宸ヤ綔镄勶纴鍙瑕佷粬浠涔嬮棿閰嶅悎濂戒简鍏朵粬閮芥棤镓璋掳纴鎴戜滑涓鑸鍙鏄鎺ㄨ崘澶у跺敖閲忔寜琛屼笟镙囧嗳瑙勮寖镎崭綔钥屽凡);鍏舵℃槸阍埚瑰綋鍓嶉”鐩鎾板啓SPEC鏂囨。锛孲PEC鏂囨。鍖呮嫭浜哛PM镓揿寘杩囩▼镄勬搷浣滃唴瀹瑰拰鏂扮敓鎴愮殑RPM鍖呯殑锘烘湰淇℃伅绛夛纴瀹幂殑浣灭敤瀵硅薄鏄镓揿寘绋嫔簭rpmbuild銆
锲 RPM鍖呭埗浣滆繃绋
1 鍑嗗囨墦鍖呯幆澧
fedora绯荤粺涓嬩娇鐢ㄥ备笅锻戒护瀹夎卹pmbuild
#yum install rpmbuild
rpmbuild镄勫伐浣灭洰褰曞备笅锛
~/rpmbuild
~/rpmbuild/SOURCES
~/rpmbuild/SPECS
~/rpmbuild/BUILD
~/rpmbuild/RPMS
~/rpmbuild/RPMS/i386
~/rpmbuild/SRPMS
濡傛灉浣犵殑鐢ㄦ埛鐩褰曚富鐩褰曚笅娌℃湁绫讳技鐩褰旷粨鏋勶纴浣犲彲浠ラ氲繃涓涓宸ュ叿杞浠舵潵镊锷ㄩ厤缃鍜岀敓鎴愶纴濡备笅銆
#yum installrpmdevtools
涓嬩简杩愯岃嚜锷ㄩ厤缃锻戒护镊锷ㄧ敓鎴愬备笂鐩褰曪纴骞堕厤缃涓浜涘繀瑕佹搷浣溿
#rpmdev-setuptree
rpmdev-setuptree锻戒护榛樿ゅ皢鍐嶅綋鍓岖敤鎴蜂富鐩褰曚笅鍒涘缓涓涓猂PM鏋勫缓镙圭洰褰旷粨鏋勶纴
濡傛灉闇瑕佹敼鍙樻¢粯璁や綅缃锛屽彲浠ヤ慨鏀归厤缃鏂囦欢:~/.rpmmacros涓鍙橀噺_topdir瀵瑰簲镄勫煎嵆鍙銆
涓鑸瑀pmbuild浼氩湪褰揿墠鐢ㄦ埛镄勪富鐩褰曚笅镊锷ㄥ缓绔嫔备笂鐩褰旷粨鏋勶纴濡傛灉鍦ㄤ綘瀵瑰簲鐢ㄦ埛镄勬瀯寤虹洰褰曚腑娌℃湁镊锷ㄥ缓绔嫔备笂鐩褰曪纴浣犲彲浠ラ氲繃镓嫔姩鏂瑰纺寤虹珛銆备笂闱㈢洰褰旷殑浣跨敤鏄杩欐牱鍒嗛厤镄勶纴SOURCES鏀剧疆镓揿寘璧勬簮锛屽寘𨰾婧愮爜镓揿寘鏂囦欢鍜岃ˉ涓佹枃浠剁瓑;SPECS鐩褰曟斁缃甋PEC鏂囨。;BUILD镓揿寘杩囩▼涓镄勫伐浣灭洰褰;RPMS鐩褰曞瓨鏀剧敓鎴愮殑浜岃繘鍒跺寘锛孯PM鍖呮牴鎹纭浠跺钩鍙颁笉钖屽垎绫伙纴i386琛ㄧず鐢熸垚i386缁撴瀯镄勫寘灏嗗瓨鏀惧湪璇ョ洰褰曚笅;SRPMS鐩褰曞瓨鏀剧敓鎴愮殑婧愮爜鍖呫
2 鎾板啓SPEC鏂囨。
SPEC鎾板啓鏄镓揿寘RPM镄勬牳蹇冿纴涔熺畻鏄链闅剧殑涓姝ワ纴濂藉湪鎴戜滑鍙浠ヤ粠鍙傜収涓涓绠鍗旷殑妯℃澘鏂囦欢寮濮嬶纴鍦ㄥ彲浠ュ疄鐜板熀链锷熻兘镄勫熀纭涓婂啀涓姝ヤ竴姝ョ殑镓╁厖鏂囨。鍐呭癸纴鐩磋呖瀹屽叏杈惧埌瑕佹眰銆备笅闱㈡槸涓涓绠鍗旷殑SPEC鏂囨。锛屽叾涓鍖呮嫭浜嗕竴浜涜存槑淇℃伅(娉锛#钖庨溃镄勫唴瀹逛负璇存槑淇℃伅)锛岃SPEC鏂囨。鏄瀵逛竴涓娴嬭瘯镄勮蒋浠堕”鐩甴ellorpm鍐欑殑锛宧ellorpm杞浠跺寘缂栬疟钖庝粎链変竴涓镓ц屾枃浠躲佷竴涓镓嫔唽鏂囦欢鍜屼竴涓椤圭洰璇存枃浠躲
hellorpm.spec鏂囨。镄勫唴瀹瑰备笅锛
-----------------------------------------------------------------------------
#杞浠跺寘绠瑕佷粙缁
Summary: hellorpm is atest program銆
#杞浠跺寘镄勫悕瀛
Name: hellorpm
#杞浠跺寘镄勪富鐗堟湰鍙
Version:2.2.6
#杞浠跺寘镄勬$増链鍙
Release: 1
#婧愪唬镰佸寘锛岄粯璁ゅ皢鍦ㄤ笂闱㈡彁鍒扮殑SOURCES鐩褰曚腑瀵绘垒
Source0:%{name}-%{version}.tar.gz
#鎺堟潈鍗忚
License: GPL
#瀹氢箟涓存椂鏋勫缓鐩褰曪纴杩欎釜鍦板潃灏嗕綔涓轰复镞跺畨瑁呯洰褰曞湪钖庨溃寮旷敤
BuildRoot:%{_tmppath}/%{name}-%{version}-%{release}-root
#杞浠跺垎绫
Group:Development/Tools
#杞浠跺寘镄勫唴瀹逛粙缁
%description
The hellorpm programis a test.
#琛ㄧず棰勬搷浣滃瓧娈碉纴钖庨溃镄勫懡浠ゅ皢鍦ㄦ簮镰佷唬镰丅UILD鍓嶆墽琛
%prep
#鏋勫缓BUILD鐜澧冿纴灏呜В铡嬫簮镰佸帇缂╁寘鍒痫UILD鐩褰
%setup-q
#BUILD瀛楁碉纴灏嗛氲繃鐩存帴璋幂敤婧愮爜鐩褰曚腑镊锷ㄦ瀯寤哄伐鍏峰畬鎴愭簮镰佺紪璇戞搷浣
%build
#璋幂敤婧愮爜鐩褰曚腑镄刢onfigure锻戒护
./configure
#鍦ㄦ簮镰佺洰褰曚腑镓ц岃嚜锷ㄦ瀯寤哄懡浠make
make
#瀹夎呭瓧娈
%install
#璋幂敤婧愮爜涓瀹夎呮墽琛岃剼链
makeDESTDIR=$RPM_BUILD_ROOT install
#鏂囦欢璇存槑瀛楁碉纴澹版槑澶氢綑鎴栬呯己灏戦兘灏嗗彲鑳藉嚭阌
%files
#璁剧疆鏂囦欢𨱒冮檺灞炴
%defattr(-,root,root)
#澹版槑/usr/local/bin/hellorpm灏嗗嚭鐜板湪杞浠跺寘涓
/usr/local/bin/hellorpm
#澹版槑骞惰剧疆鏂囦欢灞炴
%doc%attr(0444,root,root) /usr/local/man/man1/hellorpm.1
#钖屼笂锛屽0鏄庢枃妗f枃浠
%docREADME
-------------------------------------------------------------------------------
杩欎釜鏂囨。闇瑕佽存槑镄勪竴镣癸细
BuildRoot:%{_tmppath}/%{name}-%{version}-%{release}-root
涓婇溃BuildRoot鍙橀噺琛ㄧず镄勬槸婧愮爜镄勪复镞舵寜镦х洰褰曪纴rpmbuild灏辨槸阃氲繃娆$洰褰曡幏寰楀皢瑕佹寜镦у埌绯荤粺涓镄勬墍链夋枃浠讹纴钥屽湪SPEC鏂囨。钖庨溃make install 锻戒护涓镄勫弬鏁瘅ESTDIR=$RPM_BUILD_ROOT鍗虫槸瀵硅ュ弬鏁扮殑寮旷敤锛岃繖涓鍙傛暟灏嗕紶缁横akefile鏂囦欢涓锻婅瘔镊锷ㄦ瀯寤哄伐鍏峰簲璇ュ畨瑁呮枃浠堕偅閲(瀹为檯涓婃垜鍐嶅墠鏂囨彁鍒拌繃镄凪akefile闇瑕佷綔涓浜涙敼阃犱互阃傚簲RPM镄勬瀯寤哄氨鍖呮嫭姝ゆ搷浣滐纴浣犵殑Makefile鏂囦欢涓镊冲皯瑕佺煡阆揿湪RPM鏋勫缓杩囩▼涓寮旷敤姝ゅ弬鏁扮殑鍊煎幓鎺у埗瀹夎呮搷浣灭殑鐩镙)銆
濡备笂涓涓绠鍗旷殑SPEC鏂囨。鎾板啓瀹屾垚锛屼笅闱㈡妸涓涓钖崭负hellorpm-2.2.6.tar.gz镄勬簮镰佸帇缂╂枃浠舵斁鍒
rpmbuild镙圭洰褰曚笅镄凷OURCES鐩褰曚笅(娉锛岀‘淇濇ゅ綊妗f枃浠惰В铡嫔悗镄勭洰褰曚负hellorpm-2.2.6锛屽惁鍒欎细链夐梾棰)銆
鍒版や竴涓瀹屾暣镄剅pm镓揿寘鐜澧冨凡缁忔瀯寤哄畬鎴愶纴涓嬮溃鎴戜滑灏卞彲浠ュ紑濮嬫瀯寤轰簩杩涘埗鍜屾簮浠g爜RPM鍖呫
3 鏋勫缓RPM鍖
鏋勫缓RPM鍖呮槸链夊懡浠rpmbuild鍦⊿PEC镄勬寚瀵间笅瀹屾垚銆
寮濮嬫瀯寤烘搷浣滐纴棣栧厛杩涘叆鍒板綋鍓岖敤鎴风殑rpmbuild镙圭洰褰(鍗充笂闱㈡彁鍒扮殑鐩褰旷幆澧)銆
#cd ~/rpmbuild/
镓ц屽备綍锻戒护锛-ba琛ㄧずbuild all锛屽嵆鐢熸垚鍖呮嫭浜岃繘鍒跺寘鍜屾簮浠g爜鍖呯殑镓链塕PM鍖咃纴涓嬫潵濡傛灉姝e父镄勮瘽锛宺pmbuild灏嗘e父阃鍑猴纴钖屾椂鍦≧PMS鐩褰曞拰SRPMS鐩褰曚腑灏嗙敓鎴愬瑰簲镄凴PM鍖呫
#rpmbuild -baSPECS/hellorpm.spec
杩欓噷浠呬粎浠嬬粛浜嗕竴涓链绠鍗曡蒋浠剁殑链绠鍗旷殑RPM镄勬墦鍖呮搷浣滆繃绋嬶纴璇稿傚甫链夊叡浜鏂囦欢镄勯渶瑕佽繘琛屽嶆潅閰岖疆镄勫叿链夊嶆潅渚濊禆鍏崇郴镄勭瓑绛夌殑椤圭洰镄勬墦鍖呬互鍙婂悗链熺殑缁存姢锛屽寘𨰾琛ヤ竵镄勫埗浣沧垜灏嗗湪涓嬫潵镄勬椂闂村畬鎴愯ˉ鍏呮洿鏂帮纴浠婂ぉ镞堕棿涓嶆棭浜嗭纴璇ヤ紤鎭浜!
‘叁’ linux 解压 提示找不到文件
可以找到文件的,具体如下:
1、第一步,单击栏上的终端,然后输入命令[sudo
apt install rar unrar],见下图,转到下面的步骤。
‘肆’ linux7z瑙e帇锻戒护linux7z瑙e帇
濡备綍鍦╟entos绯荤粺涓嫔畨瑁7-zip骞惰В铡.7z鏂囦欢锛
镓ц屼互涓嫔懡浠や笅杞藉畨瑁咃细链钖庝竴姝makeinstall钖庡嚭鐜颁互涓嬩俊鎭锛屽嵆涓哄畨瑁呭畬姣曘
7z鏂囦欢濡备綍瑙e帇锛
7Z鏂囦欢瑙e帇鏂规硶锛
1.棣栧厛鍦ㄧ绣涓婃悳绱7ZIP涓嬭浇瀹夎
2.鍙抽敭镣瑰嚮闇瑕佽В铡嬬殑7Z鏂囦欢锛屾妸榧犳爣鏀惧埌銆7-ZIP銆戜笂灏变细寮瑰嚭瀛愯彍鍗曪纴鍦ㄥ瓙凿滃崟涓阃夋嫨銆愭彁鍙栨枃浠躲戞垨銆愭彁鍙栧埌褰揿墠鐩褰曘戦兘鍙浠ヨ繘琛岃В铡嬶纴瑙e帇钖庡氨鍙浠ユ煡鐪嬮噷闱㈢殑鏂囦欢浜嗐
濡备綍鍦↙inux涓嬭В铡嬬缉钬.7z钬濇枃浠?镐ュ晩锛
镐荤粨涓涓嬶细
1銆*.tar鐢╰ar_xvf瑙e帇
2銆*.gz鐢╣zip-d鎴栬単unzip瑙e帇
3銆*.tar.gz鍜*.tgz鐢╰ar_xzf瑙e帇
4銆*.bz2鐢╞zip2-d鎴栬呯敤bunzip2瑙e帇
5銆*.tar.bz2鐢╰ar_xjf瑙e帇
6銆*.Z鐢╱ncompress瑙e帇
7銆*.tar.Z鐢╰ar_xZf瑙e帇
8銆*.rar鐢╱nrare瑙e帇
9銆*.zip鐢╱nzip瑙e帇
7z鏂囦欢镐庝箞瑙e帇鍟婏纻
姝ラ/鏂瑰纺1
7z鏂囦欢蹇呴’鐢ㄨВ铡嬬缉杞浠舵墠鑳芥墦寮銆备娇鐢ㄧ数鑴戞墦寮浠绘剰娴忚埚櫒锛岃繍琛屼换镒忔祻瑙埚櫒锛屼互QQ娴忚埚櫒涓轰緥銆傚备笅锲撅细
姝ラ/鏂瑰纺2
镓揿紑QQ娴忚埚櫒浠ュ悗锛屼娇鐢ㄦ悳绱㈠紩镎庢悳绱⑩7z钬濄傚备笅锲撅细
姝ラ/鏂瑰纺3
鎼灭储鍒扳7z钬濅互钖庯纴镣瑰嚮镓揿紑钬7z钬濊В铡嬬缉宸ュ叿镄勫畼缃戯纴灏卞彲浠ョ湅鍒颁笅杞介摼鎺ワ纴浣嗗熀浜庣郴缁熺増链钬滀綅钬濈殑涓嶅悓锛屼笅杞介摼鎺ヤ篃鏄涓嶅悓镄勶纴浠Windows10涓扑笟鐗堬纸64浣嶏级涓轰緥銆傚备笅锲撅细
姝ラ/鏂瑰纺4
镣瑰嚮钬淒ownloda钬濋夐”锛屽氨浼氩脊鍑轰笅杞界獥鍙c傚备笅锲撅细
姝ラ/鏂瑰纺5
鐩存帴镣瑰嚮涓嬭浇锛屼笅杞藉畬鎴愬悗鍙屽嚮涓嬭浇瀹屾垚镄勬枃浠讹纴浼氩啀娆″脊鍑轰竴涓绐楀彛锛岄夋嫨钬泪nstall钬濄傚备笅锲撅细
姝ラ/鏂瑰纺6
瀹夎呭畬鎴愬悗浼氭樉绀轰竴涓绐楀彛锛岀洿鎺ョ偣鍑烩淐lose钬濄傚备笅锲撅细
姝ラ/鏂瑰纺7
瀹夎呭畬钬7z钬濊В铡嬬缉宸ュ叿浠ュ悗锛屾垒鍒伴渶瑕佽В铡嬬缉镄勨.7z钬濇牸寮忔枃浠讹纴铹跺悗浣跨敤榧犳爣鍙抽敭鍗曞嚮瀹冦傚备笅锲撅细
姝ラ/鏂瑰纺8
链钖庡湪寮瑰嚭镄勭晫闱㈤噷镓惧埌骞剁偣鍑烩7-Zip钬濓纴鍐嶉夋嫨钬沧彁鍙栧綋鍓崭綅缃钬濓纴杩欐牱钬.7z钬濇牸寮忔枃浠跺唴镄勫唴瀹瑰氨浼氲瑙e帇缂╁嚭𨱒ヤ简銆傚备笅锲撅细
linux鏂囦欢钖庣紑.7z镐庝箞瑙e帇锛
Linux绯荤粺涓嫔彲浠ヤ娇鐢7z锻戒护瑙e帇.7z鏂囦欢锛
1.棣栧厛瀹夎卲7zip-full宸ュ叿锛歴udoapt-getinstallp7zip-full
2.铹跺悗浣跨敤浠ヤ笅锻戒护𨱒ヨВ铡嬬缉鏂囦欢锛7zxfilename.7z锛屽叾涓璮ilename.7z鏄浣犺佽В铡嬬殑鏂囦欢钖嶃
‘伍’ CentOS甯哥敤锘虹锻戒护姹囨
1.鍏虫満 (绯荤粺镄勫叧链恒侀吨钖浠ュ强锏诲嚭 ) 镄勫懡浠
shutdown -h now 鍏抽棴绯荤粺(1)
init 0 鍏抽棴绯荤粺(2)
telinit 0 鍏抽棴绯荤粺(3)
shutdown -h hours:minutes 鎸夐勫畾镞堕棿鍏抽棴绯荤粺
shutdown -c 鍙栨秷鎸夐勫畾镞堕棿鍏抽棴绯荤粺
shutdown -r now 閲嶅惎(1)
reboot 閲嶅惎(2)
logout 娉ㄩ攒
2.镆ョ湅绯荤粺淇℃伅镄勫懡浠
arch 鏄剧ず链哄櫒镄勫勭悊鍣ㄦ灦鏋(1)
uname -m 鏄剧ず链哄櫒镄勫勭悊鍣ㄦ灦鏋(2)
uname -r 鏄剧ず姝e湪浣跨敤镄勫唴镙哥増链
dmidecode -q 鏄剧ず纭浠剁郴缁熼儴浠 - (SMBIOS / DMI)
hdparm -i /dev/hda 缃楀垪涓涓纾佺洏镄勬灦鏋勭壒镐
hdparm -tT /dev/sda 鍦ㄧ佺洏涓婃墽琛屾祴璇曟ц诲彇镎崭綔
cat /proc/cpuinfo 鏄剧ずCPU info镄勪俊鎭
cat /proc/interrupts 鏄剧ず涓鏂
cat /proc/meminfo 镙¢獙鍐呭瓨浣跨敤
cat /proc/swaps 鏄剧ず鍝浜泂wap琚浣跨敤
cat /proc/version 鏄剧ず鍐呮牳镄勭増链
cat /proc/net/dev 鏄剧ず缃戠粶阃傞厤鍣ㄥ强缁熻
cat /proc/mounts 鏄剧ず宸插姞杞界殑鏂囦欢绯荤粺
lspci -tv 缃楀垪 PCI 璁惧
lsusb -tv 鏄剧ず USB 璁惧
date 鏄剧ず绯荤粺镞ユ湡
cal 2007 鏄剧ず2007骞寸殑镞ュ巻琛
date 041217002007.00 璁剧疆镞ユ湡鍜屾椂闂 - 链堟棩镞跺垎骞.绉
clock -w 灏嗘椂闂翠慨鏀逛缭瀛桦埌 BIOS
3.鏂囦欢鍜岀洰褰曟搷浣滃懡浠
cd /home 杩涘叆 '/ home' 鐩褰'
cd .. 杩斿洖涓娄竴绾х洰褰
cd ../.. 杩斿洖涓娄袱绾х洰褰
cd 杩涘叆涓浜虹殑涓荤洰褰
cd ~user1 杩涘叆涓浜虹殑涓荤洰褰
cd - 杩斿洖涓婃℃墍鍦ㄧ殑鐩褰
pwd 鏄剧ず宸ヤ綔璺寰
ls 镆ョ湅鐩褰曚腑镄勬枃浠
ls -F 镆ョ湅鐩褰曚腑镄勬枃浠
ls -l 鏄剧ず鏂囦欢鍜岀洰褰旷殑璇︾粏璧勬枡
ls -a 鏄剧ず闅愯棌鏂囦欢
mkdir dir1 鍒涘缓涓涓鍙锅 'dir1' 镄勭洰褰'
mkdir dir1 dir2 钖屾椂鍒涘缓涓や釜鐩褰
mkdir -p /tmp/dir1/dir2 鍒涘缓涓涓鐩褰曟爲
rm -f file1 鍒犻櫎涓涓鍙锅 'file1' 镄勬枃浠'
rmdir dir1 鍒犻櫎涓涓鍙锅 'dir1' 镄勭洰褰'
rm -rf dir1 鍒犻櫎涓涓鍙锅 'dir1' 镄勭洰褰曞苟钖屾椂鍒犻櫎鍏跺唴瀹
rm -rf dir1 dir2 钖屾椂鍒犻櫎涓や釜鐩褰曞强瀹冧滑镄勫唴瀹
mv dir1 new_dir 閲嶅懡钖/绉诲姩 涓涓鐩褰
cp file1 file2 澶嶅埗涓涓鏂囦欢
cp dir/* . 澶嶅埗涓涓鐩褰曚笅镄勬墍链夋枃浠跺埌褰揿墠宸ヤ綔鐩褰
cp -a /tmp/dir1 . 澶嶅埗涓涓鐩褰曞埌褰揿墠宸ヤ綔鐩褰
cp -a dir1 dir2 澶嶅埗涓涓鐩褰
ln -s file1 lnk1 鍒涘缓涓涓鎸囧悜鏂囦欢鎴栫洰褰旷殑杞阈炬帴
ln file1 lnk1 鍒涘缓涓涓鎸囧悜鏂囦欢鎴栫洰褰旷殑鐗╃悊阈炬帴
touch file1 鍒涘缓涓涓鏂囦欢
4.鏂囦欢鎼灭储锻戒护
find / -name file1 浠 '/' 寮濮嬭繘鍏ユ牴鏂囦欢绯荤粺鎼灭储鏂囦欢鍜岀洰褰
find / -user user1 鎼灭储灞炰簬鐢ㄦ埛 'user1' 镄勬枃浠跺拰鐩褰
find /home/user1 -name \*.bin 鍦ㄧ洰褰 '/ home/user1' 涓鎼灭储甯︽湁'.bin' 缁揿熬镄勬枃浠
find /usr/bin -type f -atime +100 鎼灭储鍦ㄨ繃铡100澶╁唴链琚浣跨敤杩囩殑镓ц屾枃浠
find /usr/bin -type f -mtime -10 鎼灭储鍦10澶╁唴琚鍒涘缓鎴栬呬慨鏀硅繃镄勬枃浠
locate \*.ps 瀵绘垒浠 '.ps' 缁揿熬镄勬枃浠 - 鍏堣繍琛 'updatedb' 锻戒护
whereis file 鏄剧ず涓涓浜岃繘鍒舵枃浠躲佹簮镰佹垨man镄勪綅缃
which file 鏄剧ず涓涓浜岃繘鍒舵枃浠舵垨鍙镓ц屾枃浠剁殑瀹屾暣璺寰
5.镆ョ湅鏂囦欢鍐呭
cat file1 浠庣涓涓瀛楄妭寮濮嬫e悜镆ョ湅鏂囦欢镄勫唴瀹
tac file1 浠庢渶钖庝竴琛屽紑濮嫔弽钖戞煡鐪嬩竴涓鏂囦欢镄勫唴瀹
more file1 镆ョ湅涓涓闀挎枃浠剁殑鍐呭
less file1 绫讳技浜 'more' 锻戒护锛屼絾鏄瀹冨厑璁稿湪鏂囦欢涓鍜屾e悜镎崭綔涓镙风殑鍙嶅悜镎崭綔
head -2 file1 镆ョ湅涓涓鏂囦欢镄勫墠涓よ
tail -2 file1 镆ョ湅涓涓鏂囦欢镄勬渶钖庝袱琛 5.鎸傝浇锻戒护
mount /dev/hda2 /mnt/hda2 鎸傝浇涓涓鍙锅歨da2镄勭洏 (娉锛氱‘瀹氱洰褰 '/ mnt/hda2' 宸茬粡瀛桦湪)
umount /dev/hda2 鍗歌浇涓涓鍙锅歨da2镄勭洏 (鍏堜粠鎸傝浇镣 '/ mnt/hda2' 阃鍑)
fuser -km /mnt/hda2 褰撹惧囩箒蹇欐椂寮哄埗鍗歌浇
umount -n /mnt/hda2 杩愯屽嵏杞芥搷浣滆屼笉鍐椤叆 /etc/mtab 鏂囦欢(褰撴枃浠朵负鍙璇绘垨褰撶佺洏鍐欐弧镞堕潪甯告湁鐢)
mount /dev/fd0 /mnt/floppy 鎸傝浇涓涓杞鐩
mount /dev/cdrom /mnt/cdrom 鎸傝浇涓涓鍏夌洏
mount /dev/hdc /mnt/cdrecorder 鎸傝浇涓涓猚drw鎴杁vdrom
mount /dev/hdb /mnt/cdrecorder 鎸傝浇涓涓猚drw鎴杁vdrom
mount -o loop file.iso /mnt/cdrom 鎸傝浇涓涓鏂囦欢鎴朓SO闀滃儚鏂囦欢
mount -t vfat /dev/hda5 /mnt/hda5 鎸傝浇涓涓猈indows FAT32鏂囦欢绯荤粺
mount /dev/sda1 /mnt/usbdisk 鎸傝浇涓涓猽sb 鎹风洏鎴栭棯瀛樿惧
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share 鎸傝浇涓涓犸indows缃戠粶鍏变韩
6.纾佺洏绌洪棿镎崭綔镄勫懡浠
df -h 鏄剧ず宸茬粡鎸傝浇镄勫垎鍖哄垪琛
ls -lSr |more 浠ュ昂瀵稿ぇ灏忔帓鍒楁枃浠跺拰鐩褰
-sh dir1 浼扮畻鐩褰 'dir1' 宸茬粡浣跨敤镄勭佺洏绌洪棿'
-sk * | sort -rn 浠ュ归噺澶у皬涓轰緷鎹渚濇℃樉绀烘枃浠跺拰鐩褰旷殑澶у皬
7.鐢ㄦ埛鍜岀兢缁勭浉鍏冲懡浠
groupadd group_name 鍒涘缓涓涓鏂扮敤鎴风粍
groupdel group_name 鍒犻櫎涓涓鐢ㄦ埛缁
groupmod -n new_group_name old_group_name 閲嶅懡钖崭竴涓鐢ㄦ埛缁
useradd -c "Name Surname " -g admin -d /home/user1 -s /bin/bash user1 鍒涘缓涓涓灞炰簬 "admin" 鐢ㄦ埛缁勭殑鐢ㄦ埛
useradd user1 鍒涘缓涓涓鏂扮敤鎴
userdel -r user1 鍒犻櫎涓涓鐢ㄦ埛 ( '-r' 钖屾椂鍒犻櫎闄や富鐩褰)
passwd user1 淇鏀逛竴涓鐢ㄦ埛镄勫彛浠 (鍙鍏佽竢oot镓ц)
chage -E 2005-12-31 user1 璁剧疆鐢ㄦ埛鍙d护镄勫け鏁堟湡闄
ls -lh 鏄剧ず𨱒冮檺
chmod 777 directory1 璁剧疆鐩褰旷殑镓链変汉(u)銆佺兢缁(g)浠ュ强鍏朵粬浜(o)浠ヨ(r )銆佸啓(w)鍜屾墽琛(x)镄勬潈闄
chmod 700 directory1 鍒犻櫎缇ょ粍(g)涓庡叾浠栦汉(o)瀵圭洰褰旷殑璇诲啓镓ц屾潈闄
chown user1 file1 鏀瑰彉涓涓鏂囦欢镄勬墍链変汉灞炴э纴涓簎se1銆
chown -R user1 directory1 鏀瑰彉涓涓鐩褰旷殑镓链変汉灞炴у苟钖屾椂鏀瑰彉鏀圭洰褰曚笅镓链夋枃浠剁殑灞炴ч兘涓簎se1镓链
chgrp group1 file1 鏀瑰彉鏂囦欢镄勭兢缁勪负group1
chown user1:group1 file1 鏀瑰彉涓涓鏂囦欢镄勬墍链変汉鍜岀兢缁勫睘镐э纴镓灞炵粍涓篻roup1锛岀敤鎴蜂负use1銆
find / -perm -u+s 缃楀垪涓涓绯荤粺涓镓链変娇鐢ㄤ简SUID鎺у埗镄勬枃浠
chmod u+s /bin/file1 璁剧疆涓涓浜岃繘鍒舵枃浠剁殑 SUID 浣 - 杩愯岃ユ枃浠剁殑鐢ㄦ埛涔熻璧嬩篑鍜屾墍链夎呭悓镙风殑𨱒冮檺
chmod u-s /bin/file1 绂佺敤涓涓浜岃繘鍒舵枃浠剁殑 SUID浣
chmod g+s /home/public 璁剧疆涓涓鐩褰旷殑SGID 浣 - 绫讳技SUID 锛屼笉杩囱繖鏄阍埚圭洰褰旷殑
chmod g-s /home/public 绂佺敤涓涓鐩褰旷殑 SGID 浣
chmod o+t /home/public 璁剧疆涓涓鏂囦欢镄 STIKY 浣 - 鍙鍏佽稿悎娉曟墍链変汉鍒犻櫎鏂囦欢
chmod o-t /home/public 绂佺敤涓涓鐩褰旷殑 STIKY 浣
8.镓揿寘鍜岃В铡嬬缉鏂囦欢镄勫懡浠
bunzip2 file1.bz2 瑙e帇涓涓鍙锅 'file1.bz2'镄勬枃浠
bzip2 file1 铡嬬缉涓涓鍙锅 'file1' 镄勬枃浠
gunzip file1.gz 瑙e帇涓涓鍙锅 'file1.gz'镄勬枃浠
gzip file1 铡嬬缉涓涓鍙锅 'file1'镄勬枃浠
gzip -9 file1 链澶х▼搴﹀帇缂
rar a file1.rar test_file 鍒涘缓涓涓鍙锅 'file1.rar' 镄勫寘
rar a file1.rar file1 file2 dir1 镓揿寘 'file1', 'file2' 浠ュ强鐩褰 'dir1'
rar x file1.rar 瑙rar鍖
unrar x file1.rar 瑙rar鍖
tar -cvf archive.tar file1 鍒涘缓涓涓闱炲帇缂╃殑tar鍖
tar -cvf archive.tar file1 file2 dir1 鍒涘缓涓涓鍖呭惈浜 'file1', 'file2' 'dir1'镄勫寘
tar -tf archive.tar 鏄剧ず涓涓鍖呬腑镄勫唴瀹
tar -xvf archive.tar 閲婃斁涓涓鍖
tar -xvf archive.tar -C /tmp 灏嗗帇缂╁寘閲婃斁鍒 /tmp鐩褰曚笅 (-c鏄鎸囧畾鐩褰)
tar -cvfj archive.tar.bz2 dir1 鍒涘缓涓涓狰zip2镙煎纺镄勫帇缂╁寘
tar -xvfj archive.tar.bz2 瑙e帇涓涓狰zip2镙煎纺镄勫帇缂╁寘
tar -cvfz archive.tar.gz dir1 鍒涘缓涓涓猤zip镙煎纺镄勫帇缂╁寘
tar -xvfz archive.tar.gz 瑙e帇涓涓猤zip镙煎纺镄勫帇缂╁寘
zip file1.zip file1 鍒涘缓涓涓狱ip镙煎纺镄勫帇缂╁寘
zip -r file1.zip file1 file2 dir1 灏嗗嚑涓鏂囦欢鍜岀洰褰曞悓镞跺帇缂╂垚涓涓狱ip镙煎纺镄勫帇缂╁寘
unzip file1.zip 瑙e帇涓涓狱ip镙煎纺铡嬬缉鍖
9.鍏充簬RPM 鍖呯殑锻戒护
rpm -ivh package.rpm 瀹夎呬竴涓猺pm鍖
rpm -ivh --nodeeps package.rpm 瀹夎呬竴涓猺pm鍖呰屽拷鐣ヤ緷璧栧叧绯昏﹀憡
rpm -U package.rpm 镟存柊涓涓猺pm鍖呬絾涓嶆敼鍙桦叾閰岖疆鏂囦欢
rpm -F package.rpm 镟存柊涓涓纭瀹氩凡缁忓畨瑁呯殑rpm鍖
rpm -e package_name.rpm 鍒犻櫎涓涓猺pm鍖
rpm -qa 鏄剧ず绯荤粺涓镓链夊凡缁忓畨瑁呯殑rpm鍖
rpm -qa | grep httpd 鏄剧ず镓链夊悕绉颁腑鍖呭惈 "httpd" 瀛楁牱镄剅pm鍖
rpm -qi package_name 銮峰彇涓涓宸插畨瑁呭寘镄勭壒娈娄俊鎭
rpm -ql package_name 鏄剧ず涓涓宸茬粡瀹夎呯殑rpm鍖呮彁渚涚殑鏂囦欢鍒楄〃
rpm -qc package_name 鏄剧ず涓涓宸茬粡瀹夎呯殑rpm鍖呮彁渚涚殑閰岖疆鏂囦欢鍒楄〃
rpm -q package_name --whatrequires 鏄剧ず涓庝竴涓猺pm鍖呭瓨鍦ㄤ緷璧栧叧绯荤殑鍒楄〃
rpm -q package_name --whatprovides 鏄剧ず涓涓猺pm鍖呮墍鍗犵殑浣撶Н
rpm -q package_name --scripts 鏄剧ず鍦ㄥ畨瑁/鍒犻櫎链熼棿镓镓ц岀殑鑴氭湰l
rpm -q package_name --changelog 鏄剧ず涓涓猺pm鍖呯殑淇鏀瑰巻鍙
rpm -qf /etc/httpd/conf/httpd.conf 纭璁ゆ墍缁欑殑鏂囦欢鐢卞摢涓猺pm鍖呮墍鎻愪緵
rpm -qp package.rpm -l 鏄剧ず鐢变竴涓灏氭湭瀹夎呯殑rpm鍖呮彁渚涚殑鏂囦欢鍒楄〃
rpm --import /media/cdrom/RPM-GPG-KEY 瀵煎叆鍏阍ユ暟瀛楄瘉涔
rpm --checksig package.rpm 纭璁や竴涓猺pm鍖呯殑瀹屾暣镐
rpm -qa gpg-pubkey 纭璁ゅ凡瀹夎呯殑镓链塺pm鍖呯殑瀹屾暣镐
rpm -V package_name 妫镆ユ枃浠跺昂瀵搞 璁稿彲銆佺被鍨嬨佹墍链夎呫佺兢缁勚丮D5妫镆ヤ互鍙婃渶钖庝慨鏀规椂闂
rpm -Va 妫镆ョ郴缁熶腑镓链夊凡瀹夎呯殑rpm鍖- 灏忓绩浣跨敤
rpm -Vp package.rpm 纭璁や竴涓猺pm鍖呰缮链瀹夎
rpm2cpio package.rpm | cpio --extract --make-directories *bin* 浠庝竴涓猺pm鍖呰繍琛屽彲镓ц屾枃浠
rpm -ivh /usr/src/redhat/RPMS/`arch`/package.rpm 浠庝竴涓猺pm婧愮爜瀹夎呬竴涓鏋勫缓濂界殑鍖
rpmbuild --rebuild package_name.src.rpm 浠庝竴涓猺pm婧愮爜鏋勫缓涓涓 rpm 鍖
10.YUM 杞浠跺寘鍗囩骇鍣
yum install package_name 涓嬭浇骞跺畨瑁呬竴涓猺pm鍖
yum localinstall package_name.rpm 灏嗗畨瑁呬竴涓猺pm鍖咃纴浣跨敤浣犺嚜宸辩殑杞浠朵粨搴扑负浣犺В鍐虫墍链変緷璧栧叧绯
yum update package_name.rpm 镟存柊褰揿墠绯荤粺涓镓链夊畨瑁呯殑rpm鍖
yum update package_name 镟存柊涓涓猺pm鍖
yum remove package_name 鍒犻櫎涓涓猺pm鍖
yum list 鍒楀嚭褰揿墠绯荤粺涓瀹夎呯殑镓链夊寘
yum search package_name 鍦╮pm浠揿簱涓鎼滃昏蒋浠跺寘
yum clean packages 娓呯悊rpm缂揿瓨鍒犻櫎涓嬭浇镄勫寘
yum clean headers 鍒犻櫎镓链夊ご鏂囦欢
yum clean all 鍒犻櫎镓链夌紦瀛樼殑鍖呭拰澶存枃浠
‘陆’ Centos7 下怎么解压tar.gz 文件
例如/home
cd /home //进入/home目录
tar -xvjf XXX.tar.bz2 //解压.tar.bz2包,centos下已经有bz2的解压程序不用另外安装东西。
这一步解压已经完成了
如果是还要安装源码的话(源码可被安装),然后就是常用的三个命令。
./config //有些源码包不用这一步,如果提示没有找到目录或文件,就直接跳过这步
make //编译
make install //安装,这步要root权限。
‘柒’ Linux中压缩与解压缩:
(1)使用tar命令备份数据的格式如下:
$ tar cvf backup.tar /home/html
上述命令是将/home/html 目录下的所有文件打包成tar文件backup.tar。
cvf是tar的命令参数。
c代表创建一个档案文件,
v代表显示每个备份的文件名字,
f表示tar创建的档案文件名是后面的backup.tar,
/home/html 代表tar要备份的文件或和目录名。
(2)使用tar命令恢复数据的格式如下:
$ tar xvf backup.tar
上述命令将备份文件backup.tar恢复到当前目录下。
通常情况下,tar对文件进行备份的时候并不对文件进行压缩,因此备份文件的尺寸非常大。使用如下的命令,将使tar在备份结束以后,自动使用gzip命令对备份文件进行压缩,得到一个相应的gz文件。
$ tar zcvf backup.tar.gz /home/html
这样,我们可以得到压缩文件backup.tar.gz。
zip命令....