Skip to content


http proxy สำหรับ apt-get

ในกรณีที่เครื่องของเราอยู่หลังเครื่อง proxy เช่น เครื่องใน office ทั่วไป จะไม่สามารถใช้งาน apt-get ได้เนื่องจาก apt-get ต้องไปดึง file ผ่าน http ซึ่งไม่สามารวิ่งทะลุผ่าน gateway ได้โดยตรง
apt-get จึงต้องวิ่งผ่าน proxy โดยสามารถทำได้โดยเติม ใน file .bashrc ใน home directory

# apt-get proxy
export http_proxy=http://[proxy ID or domain]:[port]/
export ftp_proxy=ftp://[proxy ID or domain]:[port]/

อย่าลืม log in ใหม่
แต่ในกรณีจากการทดสอบ จะไม่สามารถใช้ sudo ได้ เพราะมันจะไม่โหลด environment ของ user ของเราไปด้วย ดังนั้นจึงต้องเข้าด้วย sudo -s เพื่อไปเป็น root ก่อน
เมื่อเข้าไปแล้วลอง export environment ออกมาดู จะเป็น http_proxy เป็นค่าที่เราใส่เข้าไป

user# export

จะสังเกตว่าปลายทางที่เราไปดึงข้อมูลจะเป็น ip หรือ domain ของ proxy

Posted in Linux, Networking. Tagged with , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.