Ìá¸ßн×ÊÀë²»¿ªµÄÒªº¦ÊÖÒÕ£ºLinuxÔËά
Ìá¸ßн×ÊÀë²»¿ªµÄÒªº¦ÊÖÒÕ£ºLinuxÔËά
Ëæ×Å»¥ÁªÍøµÄ¿ìËÙÉú³¤£¬Linux²Ù×÷ϵͳ×÷ΪһÖÖ¸ßЧ¡¢Îȹ̵ÄЧÀÍÆ÷²Ù×÷ϵͳ»ñµÃÁËÆÕ±éÓ¦Óá£×÷Ϊһ¸öLinuxÔËά¹¤³Ìʦ£¬ÊìÁ·ÕÆÎÕLinux²Ù×÷ϵͳºÍÏà¹ØÊÖÒÕ£¬²»µ«¿ÉÒÔΪÆóÒµÌṩÎȹ̿ɿ¿µÄIT»ù´¡ÉèÊ©£¬»¹¿ÉÒÔΪ×Ô¼ºµÄн×Êˮƽ´øÀ´ÏÔ×ŵÄÌáÉý¡£±¾ÎĽ«ÏÈÈÝһЩLinuxÔËάÖг£¼ûµÄÒªº¦ÊÖÒÕ£¬²¢¸½ÉÏÏìÓ¦µÄ´úÂëʾÀý£¬ÈÃÎÒÃÇÒ»ÆðÀ´Ì½ÌÖÕâ¸ö»°Ìâ¡£
Ò»¡¢ÏµÍ³×°ÖúÍÉèÖÃ
LinuxÔËάµÄ»ù´¡ÊÂÇéÖ®Ò»¾ÍÊÇÄܹ»ÊìÁ·µØ¾ÙÐÐϵͳװÖúÍÉèÖá£ÊìϤÖÖÖÖ¿¯ÐаæµÄ×°ÖÃÁ÷³Ì¡¢Ó²ÅÌ·ÖÇø¡¢ÍøÂçÉèÖõÈÊDZر¸µÄÊÖÒÕÖ®Ò»¡£
ÀýÈ磬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´Éó²éϵͳ°æ±¾£º
lsb_release -a
µÇ¼ºó¸´ÖÆ
»òÕßʹÓÃÒÔÏÂÏÂÁîÀ´Éó²éÍøÂçÉèÖãº
ifconfig -a
µÇ¼ºó¸´ÖÆ
¶þ¡¢Shell¾ç±¾±à³Ì
Shell¾ç±¾±à³ÌÊÇLinuxÔËάÖеÄÖ÷ÒªÒ»»·£¬Í¨¹ý±àд¾ç±¾¿ÉÒÔÌá¸ßÊÂÇéЧÂʺÍ×Ô¶¯»¯´¦Àí¡£ÊìϤ³£ÓõÄShell¾ç±¾Óï·¨ºÍÏÂÁÄܹ»±àд½ÅÔÀ´Ö´ÐÐÒ»Ñùƽ³£ÊÂÇéʹÃü¡£
ÏÂÃæÊÇÒ»¸ö¼òÆÓµÄʾÀý£¬ÊµÏÖÁ˲éÕÒ²¢É¾³ýÖ¸¶¨Ä¿Â¼ÏµÄÖظ´Îļþ£º
#!/bin/bash find /path/to/directory -type f -exec md5sum {} ; | sort | uniq -d | awk '{print $2}' | xargs rm -rf
µÇ¼ºó¸´ÖÆ
Èý¡¢ÍøÂçºÍÇå¾²ÉèÖÃ
×÷ΪһÃûLinuxÔËά¹¤³Ìʦ£¬ÏàʶÍøÂçºÍÇå¾²ÉèÖÃÊDZز»¿ÉÉٵġ£ÊìϤÍøÂç×°±¸ÉèÖᢷÀ»ðǽÉèÖᢶ˿ںÍЧÀ͵ÄÖÎÀíµÈÄܹ»È·±£Ð§ÀÍÆ÷µÄÇå¾²ºÍÎȹ̡£
ÒÔÏÂÊÇÒ»¸öʹÓÃiptablesʵÏֶ˿Úת·¢µÄʾÀý£º
# ¿ªÆô¶Ë¿Úת·¢¹¦Ð§ echo 1 > /proc/sys/net/ipv4/ip_forward # ½«ÍâÍøµÄ80¶Ë¿Úת·¢µ½ÄÚÍøµÄ8080¶Ë¿Ú iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.10:8080 iptables -t nat -A POSTROUTING -p tcp -d 192.168.1.10 --dport 8080 -j SNAT --to-source 192.168.1.1
µÇ¼ºó¸´ÖÆ
ËÄ¡¢ÐÔÄܵ÷Óź͹ÊÕÏÅŲé
LinuxÔËά¹¤³ÌʦӦ¸Ã¾ß±¸ÐÔÄܵ÷Óź͹ÊÕÏÅŲéµÄÄÜÁ¦£¬Äܹ»ÊµÊ±·¢Ã÷²¢½â¾öϵͳÐÔÄÜ·½ÃæµÄÎÊÌâ¡£ÊìϤ³£ÓõÄϵͳÐÔÄܼà¿Ø¹¤¾ßºÍµ÷ÓÅÒªÁìÄܹ»Ìá¸ßϵͳµÄÎȹÌÐÔºÍÐÔÄÜ¡£
ÒÔÏÂÊÇÒ»¸öʹÓÃsarÏÂÁîʵʱ¼à¿ØϵͳÐÔÄܵÄʾÀý£º
sar -u 1 10
µÇ¼ºó¸´ÖÆ
Îå¡¢×Ô¶¯»¯ÔËά
Ëæ×ÅÆóÒµ¹æÄ£µÄÒ»Ö±À©´ó£¬LinuxЧÀÍÆ÷µÄÊýÄ¿Ò²Ô½À´Ô½¶à£¬ÔõÑù¸ßЧµØÖÎÀíºÍά»¤ÕâЩЧÀÍÆ÷³ÉΪÁËÒ»¸öÌôÕ½¡£ÕÆÎÕ×Ô¶¯»¯ÔËά¹¤¾ßºÍÊÖÒÕ£¬Äܹ»Ìá¸ßÊÂÇéЧÂÊ¡£
ÒÔÏÂÊÇÒ»¸öʹÓÃAnsible¾ÙÐÐЧÀÍÆ÷ÉèÖÃÖÎÀíµÄʾÀý£º
- name: Install and start Apache hosts: webservers tasks: - name: Install Apache yum: name: httpd state: latest become: true - name: Start Apache service: name: httpd state: started become: true
µÇ¼ºó¸´ÖÆ
Áù¡¢¹ÊÕÏÓ¦¼±´¦Àí
×÷ΪһÃûLinuxÔËά¹¤³Ìʦ£¬Äܹ»¿ìËÙ¡¢×¼È·µØ´¦Àíϵͳ¹ÊÕÏÊÇÖÁ¹ØÖ÷ÒªµÄ¡£ÊìϤ³£¼ûµÄ¹ÊÕÏÅŲéÒªÁìºÍ¼¼ÇÉ£¬Äܹ»Ñ¸ËÙ¶¨Î»ÎÊÌâ²¢½ÓÄÉÏìÓ¦µÄÓ¦¼±²½·¥¡£
ÒÔÏÂÊÇÒ»¸öʹÓÃdmesgÏÂÁîÉó²éϵͳÈÕÖ¾µÄʾÀý£º
dmesg | grep "error"
µÇ¼ºó¸´ÖÆ
½áÓ
LinuxÔËάÊÇÒ»¸öºÜÊÇÆձ顢ÖØ´ó¶øÓÖÒªº¦µÄÁìÓò£¬ÊìÁ·ÕÆÎÕLinuxÔËάÊÖÒÕ²»µ«¿ÉÒÔΪÆóÒµÌṩÎȹ̿ɿ¿µÄIT»ù´¡ÉèÊ©£¬»¹¿ÉÒÔΪСÎÒ˽È˵Äн×Êˮƽ´øÀ´ÏÔÖøÌáÉý¡£±¾ÎÄÏÈÈÝÁËһЩLinuxÔËάÖг£¼ûµÄÒªº¦ÊÖÒÕ£¬²¢¸½ÉÏÁËÏìÓ¦µÄ´úÂëʾÀý¡£Ï£ÍûÄܹ»×ÊÖú¶ÁÕß½øÒ»²½Ïàʶ²¢ÕÆÎÕÕâЩÊÖÒÕ£¬Ìá¸ß×Ô¼ºÔÚLinuxÔËάÁìÓòµÄ¾ºÕùÁ¦¡£
ÒÔÉϾÍÊÇÌá¸ßн×ÊÀë²»¿ªµÄÒªº¦ÊÖÒÕ£ºLinuxÔËάµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡