Linux์—์„œ ์‚ฌ์šฉ์ž ๋ชจ๋“œ ์‚ฌ์šฉ์„ ์‹œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•

๋ฒˆ์—ญ๊ฐ€ ์†Œ๊ฐœ: ๋‹ค์–‘ํ•œ ์ข…๋ฅ˜์˜ ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์šฐ๋ฆฌ ์‚ถ์— ๋Œ€๊ทœ๋ชจ๋กœ ์œ ์ž…๋˜๋Š” ์ƒํ™ฉ์—์„œ ๋ชจ๋“  ๊ฒƒ์ด ์–ด๋–ค ๊ธฐ์ˆ ๋กœ ์‹œ์ž‘๋˜์—ˆ๋Š”์ง€ ์•Œ์•„๋‚ด๋Š” ๊ฒƒ์€ ๋งค์šฐ ํฅ๋ฏธ๋กญ๊ณ  ์œ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘ ์ผ๋ถ€๋Š” ์˜ค๋Š˜๋‚ ๊นŒ์ง€ ์œ ์šฉํ•˜๊ฒŒ ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ์ง€๋งŒ ๋ชจ๋“  ์‚ฌ๋žŒ์ด ๊ทธ๋Ÿฌํ•œ ๋ฐฉ๋ฒ•์„ ๊ธฐ์–ตํ•˜๋Š” ๊ฒƒ์€ ์•„๋‹™๋‹ˆ๋‹ค(๋˜๋Š” ๊ธ‰์†ํ•œ ๊ฐœ๋ฐœ ๊ณผ์ •์—์„œ ๋ฐœ๊ฒฌ๋˜์ง€ ์•Š์•˜๋Š”์ง€ ์•„๋Š” ๊ฒฝ์šฐ๋„ ์žˆ์Šต๋‹ˆ๋‹ค). ๊ทธ๋Ÿฌํ•œ ๊ธฐ์ˆ  ์ค‘ ํ•˜๋‚˜๊ฐ€ ์‚ฌ์šฉ์ž ๋ชจ๋“œ Linux์ž…๋‹ˆ๋‹ค. ์›๋ณธ์˜ ์ž‘์„ฑ์ž๋Š” ๋งŽ์€ ์กฐ์‚ฌ๋ฅผ ์ˆ˜ํ–‰ํ•˜์—ฌ ์ด์ „ ๊ฐœ๋ฐœ ์ค‘ ์–ด๋–ค ๊ฒƒ์ด ์—ฌ์ „ํžˆ ์ž‘๋™ํ•˜๊ณ  ์–ด๋–ค ๊ฒƒ์ด ์ž‘๋™ํ•˜์ง€ ์•Š๋Š”์ง€ ํŒŒ์•…ํ•˜๊ณ  2k19์—์„œ ํ™ˆ๋ธŒ๋ฃจ UML์„ ์–ป๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ๋‹จ๊ณ„๋ณ„ ์ง€์นจ๊ณผ ๊ฐ™์€ ๋‚ด์šฉ์„ ์ •๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ทธ๋ ‡์Šต๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๋Š” ์›๋ณธ ๊ฒŒ์‹œ๋ฌผ์˜ ์ž‘์„ฑ์ž๋ฅผ Habr์— ์ดˆ๋Œ€ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ผ€์ด๋””, ๊ถ๊ธˆํ•œ ์ ์ด ์žˆ์œผ๋ฉด ๋Œ“๊ธ€๋กœ ์˜์–ด๋กœ ์งˆ๋ฌธํ•˜์„ธ์š”.

Linux์—์„œ ์‚ฌ์šฉ์ž ๋ชจ๋“œ ์‚ฌ์šฉ์„ ์‹œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•

Linux์˜ ์‚ฌ์šฉ์ž ๋ชจ๋“œ๋Š” ์‹ค์ œ๋กœ Linux ์ปค๋„ ์ž์ฒด์— ๋Œ€ํ•œ ํฌํŠธ์ž…๋‹ˆ๋‹ค. ์ด ๋ชจ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ „์ฒด Linux ์ปค๋„์„ ์‚ฌ์šฉ์ž ํ”„๋กœ์„ธ์Šค๋กœ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ์ผ๋ฐ˜์ ์œผ๋กœ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋“œ๋ผ์ด๋ฒ„๋ฅผ ํ…Œ์ŠคํŠธํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด ๋ชจ๋“œ๋Š” ์ผ๋ฐ˜ ๊ฒฉ๋ฆฌ ๋„๊ตฌ๋กœ๋„ ์œ ์šฉํ•˜๋ฉฐ ๊ทธ ์›๋ฆฌ๋Š” ๊ฐ€์ƒ ๋จธ์‹ ์˜ ์ž‘๋™๊ณผ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์ด ๋ชจ๋“œ๋Š” Docker๋ณด๋‹ค ๋” ๋งŽ์€ ๊ฒฉ๋ฆฌ๋ฅผ ์ œ๊ณตํ•˜์ง€๋งŒ KVM ๋˜๋Š” Virtual Box์™€ ๊ฐ™์€ ๋ณธ๊ฒฉ์ ์ธ ๊ฐ€์ƒ ๋จธ์‹ ๋ณด๋‹ค๋Š” ์ ์Šต๋‹ˆ๋‹ค.

์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉ์ž ๋ชจ๋“œ๋Š” ์ด์ƒํ•˜๊ณ  ์‚ฌ์šฉํ•˜๊ธฐ ์–ด๋ ค์šด ๋„๊ตฌ์ฒ˜๋Ÿผ ๋ณด์ผ ์ˆ˜ ์žˆ์ง€๋งŒ ์—ฌ์ „ํžˆ ๊ทธ ์šฉ๋„๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฒฐ๊ตญ ์ด๊ฒƒ์€ ๊ถŒํ•œ์ด ์—†๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์‹คํ–‰ํ•˜๋Š” ์™„์ „ํ•œ Linux ์ปค๋„์ž…๋‹ˆ๋‹ค. ์ด ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ฉด ์ž ์žฌ์ ์œผ๋กœ ์‹ ๋ขฐํ•  ์ˆ˜ ์—†๋Š” ์ฝ”๋“œ๊ฐ€ ํ˜ธ์ŠคํŠธ ์‹œ์Šคํ…œ์— ๋Œ€ํ•œ ์œ„ํ˜‘ ์—†์ด ์‹คํ–‰๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ด๊ฒƒ์€ ๋ณธ๊ฒฉ์ ์ธ ์ปค๋„์ด๊ธฐ ๋•Œ๋ฌธ์— ํ”„๋กœ์„ธ์Šค๊ฐ€ ํ˜ธ์ŠคํŠธ ์‹œ์Šคํ…œ์œผ๋กœ๋ถ€ํ„ฐ ๊ฒฉ๋ฆฌ๋ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ๋ชจ๋“œ ๋‚ด์—์„œ ์‹คํ–‰๋˜๋Š” ํ”„๋กœ์„ธ์Šค๋Š” ํ˜ธ์ŠคํŠธ์— ํ‘œ์‹œ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.. ์ด๋Š” ํ˜ธ์ŠคํŠธ ์‹œ์Šคํ…œ์ด ํ•ญ์ƒ ์ €์žฅ์†Œ ๋‚ด๋ถ€์˜ ํ”„๋กœ์„ธ์Šค๋ฅผ ๋ณด๋Š” ์ผ๋ฐ˜์ ์ธ Docker ์ปจํ…Œ์ด๋„ˆ์™€๋Š” ๋‹ค๋ฆ…๋‹ˆ๋‹ค. ๋‚ด ์„œ๋ฒ„ ์ค‘ ํ•˜๋‚˜์—์„œ ๋‹ค์Œ pstree ์กฐ๊ฐ์„ ๋ณด์‹ญ์‹œ์˜ค.

containerdโ”€โ”ฌโ”€containerd-shimโ”€โ”ฌโ”€tiniโ”€โ”ฌโ”€dnsdโ”€โ”€โ”€19*[{dnsd}]
           โ”‚                 โ”‚      โ””โ”€s6-svscanโ”€โ”€โ”€s6-supervise
           โ”‚                 โ””โ”€10*[{containerd-shim}]
           โ”œโ”€containerd-shimโ”€โ”ฌโ”€tiniโ”€โ”ฌโ”€aerialโ”€โ”€โ”€21*[{aerial}]
           โ”‚                 โ”‚      โ””โ”€s6-svscanโ”€โ”€โ”€s6-supervise
           โ”‚                 โ””โ”€10*[{containerd-shim}]
           โ”œโ”€containerd-shimโ”€โ”ฌโ”€tiniโ”€โ”ฌโ”€s6-svscanโ”€โ”€โ”€s6-supervise
           โ”‚                 โ”‚      โ””โ”€surl
           โ”‚                 โ””โ”€9*[{containerd-shim}]
           โ”œโ”€containerd-shimโ”€โ”ฌโ”€tiniโ”€โ”ฌโ”€hโ”€โ”€โ”€13*[{h}]
           โ”‚                 โ”‚      โ””โ”€s6-svscanโ”€โ”€โ”€s6-supervise
           โ”‚                 โ””โ”€10*[{containerd-shim}]
           โ”œโ”€containerd-shimโ”€โ”ฌโ”€goproxyโ”€โ”€โ”€14*[{goproxy}]
           โ”‚                 โ””โ”€9*[{containerd-shim}]
           โ””โ”€32*[{containerd}]

๊ทธ๋ฆฌ๊ณ  ์ด๋ฅผ ์‚ฌ์šฉ์ž ๋ชจ๋“œ์˜ Linux ์ปค๋„ pstree์™€ ๋น„๊ตํ•ด ๋ณด์„ธ์š”.

linuxโ”€โ”ฌโ”€5*[linux]
      โ””โ”€slirp

Docker ์ปจํ…Œ์ด๋„ˆ๋กœ ์ž‘์—…ํ•  ๋•Œ ๊ฒŒ์ŠคํŠธ์—์„œ ์‹คํ–‰ ์ค‘์ธ ํ”„๋กœ์„ธ์Šค์˜ ์ด๋ฆ„์„ ํ˜ธ์ŠคํŠธ์—์„œ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Linux ์‚ฌ์šฉ์ž ๋ชจ๋“œ์—์„œ๋Š” ์ด๊ฒƒ์ด ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ๋ฌด์Šจ ๋œป์ด์—์š”? ์ด๋Š” Linux์˜ ๊ฐ์‚ฌ ํ•˜์œ„ ์‹œ์Šคํ…œ์„ ํ†ตํ•ด ์‹คํ–‰๋˜๋Š” ๋ชจ๋‹ˆํ„ฐ๋ง ๋„๊ตฌ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๋ณด์ง€ ๋ชปํ•˜๋‹ค ๊ฒŒ์ŠคํŠธ ์‹œ์Šคํ…œ์—์„œ ์‹คํ–‰๋˜๋Š” ํ”„๋กœ์„ธ์Šค. ๊ทธ๋Ÿฌ๋‚˜ ์–ด๋–ค ์ƒํ™ฉ์—์„œ๋Š” ์ด ๊ธฐ๋Šฅ์ด ์–‘๋‚ ์˜ ๊ฒ€์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ผ๋ฐ˜์ ์œผ๋กœ ์•„๋ž˜ ์ „์ฒด ๊ฒŒ์‹œ๋ฌผ์€ ์›ํ•˜๋Š” ๊ฒฐ๊ณผ๋ฅผ ์–ป๊ธฐ ์œ„ํ•œ ์—ฐ๊ตฌ์™€ ๋Œ€๋žต์ ์ธ ์‹œ๋„๋ฅผ ๋ชจ์•„๋†“์€ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด ๋‚˜๋Š” ๋‹ค์–‘ํ•œ ๊ณ ๋Œ€ ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , ์ปค๋„ ์†Œ์Šค๋ฅผ ์ฝ๊ณ , ์ดˆ๋“ฑํ•™๊ต ์‹œ์ ˆ์— ์ž‘์„ฑ๋œ ์ฝ”๋“œ๋ฅผ ์ง‘์ค‘์ ์œผ๋กœ ๋””๋ฒ„๊น…ํ•˜๊ณ , ํ•„์š”ํ•œ ๋„๊ตฌ๋ฅผ ์ฐพ๊ธฐ ์œ„ํ•ด ํŠน์ˆ˜ ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Heroku ๋นŒ๋“œ๋ฅผ ๋งŒ์ง€์ž‘๊ฑฐ๋ ค์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค. . ์ด ๋ชจ๋“  ์ž‘์—…์œผ๋กœ ์ธํ•ด ๋‚ด IRC ์ง์›๋“ค์€ ๋‚˜๋ฅผ ๋งˆ์ˆ ์ด๋ผ๊ณ  ๋ถ€๋ฅด๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ฒŒ์‹œ๋ฌผ์ด ๋ˆ„๊ตฐ๊ฐ€๊ฐ€ ์ตœ์‹  ์ปค๋„ ๋ฐ OS ๋ฒ„์ „์œผ๋กœ ๋™์ผํ•œ ์ž‘์—…์„ ์‹œ๋„ํ•  ์ˆ˜ ์žˆ๋Š” ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์„œ๊ฐ€ ๋˜๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.

์กฐ์ •

Linux ์‚ฌ์šฉ์ž ๋ชจ๋“œ ์„ค์ •์€ ์—ฌ๋Ÿฌ ๋‹จ๊ณ„๋กœ ์ˆ˜ํ–‰๋ฉ๋‹ˆ๋‹ค.

  • ํ˜ธ์ŠคํŠธ์— ์ข…์†์„ฑ์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
  • Linux ์ปค๋„ ๋‹ค์šด๋กœ๋“œ;
  • ์ปค๋„ ๋นŒ๋“œ ๊ตฌ์„ฑ;
  • ์ปค๋„ ์–ด์…ˆ๋ธ”๋ฆฌ;
  • ๋ฐ”์ด๋„ˆ๋ฆฌ ์„ค์น˜;
  • ๊ฒŒ์ŠคํŠธ ํŒŒ์ผ ์‹œ์Šคํ…œ ๊ตฌ์„ฑ
  • ์ปค๋„ ์‹œ์ž‘ ๋งค๊ฐœ๋ณ€์ˆ˜ ์„ ํƒ
  • ๊ฒŒ์ŠคํŠธ ๋„คํŠธ์›Œํฌ ์„ค์ •;
  • ๊ฒŒ์ŠคํŠธ ์ปค๋„์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

๋‚˜๋Š” ๋‹น์‹ ์ด ์Šค์Šค๋กœ ํ•˜๊ธฐ๋กœ ๊ฒฐ์ •ํ–ˆ๋‹ค๋ฉด ์šฐ๋ถ„ํˆฌ๋‚˜ ๋ฐ๋น„์•ˆ๊ณผ ๊ฐ™์€ ์‹œ์Šคํ…œ์—์„œ ์„ค๋ช…ํ•œ ๋ชจ๋“  ๊ฒƒ์„ ํ•  ๊ฐ€๋Šฅ์„ฑ์ด ๋†’๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค. ๋‚˜๋Š” ๋‚ด๊ฐ€ ๊ฐ€์žฅ ์ข‹์•„ํ•˜๋Š” ๋ฐฐํฌํŒ์ธ Alpine์—์„œ ์œ„์˜ ๋ชจ๋“  ๊ฒƒ์„ ๊ตฌํ˜„ํ•˜๋ ค๊ณ  ์‹œ๋„ํ–ˆ์ง€๋งŒ ์•„๋ฌด๊ฒƒ๋„ ๋‚˜์˜ค์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ๋ถ„๋ช…ํžˆ Linux ์ปค๋„์—๋Š” ์‚ฌ์šฉ์ž ๋ชจ๋“œ์˜ ๋“œ๋ผ์ด๋ฒ„์— ๋Œ€ํ•œ ํ•˜๋“œ ๋ฐ”์ธ๋”ฉ glibc-isms๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๋งˆ์นจ๋‚ด ๋ฌธ์ œ๋ฅผ ์ดํ•ดํ•œ ํ›„์— ์ด๋ฅผ ์—…์ŠคํŠธ๋ฆผ์— ๋ณด๊ณ ํ•  ๊ณ„ํš์ž…๋‹ˆ๋‹ค.

ํ˜ธ์ŠคํŠธ์— ์ข…์†์„ฑ ์„ค์น˜

Ubuntu์—์„œ๋Š” Linux ์ปค๋„์„ ๋นŒ๋“œํ•˜๋ ค๋ฉด ์ตœ์†Œํ•œ ๋‹ค์Œ ํŒจํ‚ค์ง€๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค(์ƒˆ๋กœ ์„ค์น˜ํ•œ๋‹ค๊ณ  ๊ฐ€์ •).

- 'build-essential'
- 'flex'
- 'bison'
- 'xz-utils'
- 'wget'
- 'ca-certificates'
- 'bc'
- 'linux-headers'

๋‹ค์Œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์—ฌ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(๋ฃจํŠธ ๋˜๋Š” sudo ์‚ฌ์šฉ).

apt-get -y install build-essential flex bison xz-utils wget ca-certificates bc 
                   linux-headers-$(uname -r)

Linux ์ปค๋„ ๋ฉ”๋‰ด ์„ค์ • ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. libncurses-dev. ๋‹ค์Œ ๋ช…๋ น(๋ฃจํŠธ ๋˜๋Š” sudo)์„ ์‚ฌ์šฉํ•˜์—ฌ ์„ค์น˜๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.

apt-get -y install libncurses-dev

์ปค๋„ ๋‹ค์šด๋กœ๋“œ

์ปค๋„์„ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ๋นŒ๋“œํ•  ์œ„์น˜๋ฅผ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค. ์ด ์ž‘์—…์„ ์œ„ํ•ด์„œ๋Š” ์•ฝ 1,3GB์˜ ํ•˜๋“œ ๋””์Šคํฌ ๊ณต๊ฐ„์„ ํ• ๋‹นํ•ด์•ผ ํ•˜๋ฏ€๋กœ ์ด๋ฅผ ํ™•๋ณดํ•˜์‹ญ์‹œ์˜ค.

๋‹ค์Œ์œผ๋กœ ์ด๋™ํ•œ ํ›„ kernel.org ์ตœ์‹  ์•ˆ์ •์ ์ธ ์ปค๋„์„ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋Š” URL์„ ์–ป์œผ์„ธ์š”. ์ž‘์„ฑ ๋‹น์‹œ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.1.16.tar.xz

๋‹ค์Œ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•˜์„ธ์š”. 'wget':

wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.1.16.tar.xz

๊ทธ๋ฆฌ๊ณ  ๊ทธ๊ฒƒ์„ ์ถ”์ถœ 'tar':

tar xJf linux-5.1.16.tar.xz

์ด์ œ tarball์˜ ์••์ถ•์„ ํ’€ ๋•Œ ์ƒ์„ฑ๋œ ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค:

cd linux-5.1.16

์ปค๋„ ๋นŒ๋“œ ์„ค์ •

์ปค๋„ ๋นŒ๋“œ ์‹œ์Šคํ…œ์€ ์„ธํŠธ์ž…๋‹ˆ๋‹ค. ๋ฉ”์ดํฌํŒŒ์ผ ั ๋งŽ์€ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ž๋™ํ™”ํ•˜๋Š” ์‚ฌ์šฉ์ž ์ •์˜ ๋„๊ตฌ ๋ฐ ์Šคํฌ๋ฆฝํŠธ. ๋จผ์ € ๋Œ€ํ™”ํ˜• ์„ค์น˜ ํ”„๋กœ๊ทธ๋žจ์„ ์—ฝ๋‹ˆ๋‹ค.

make ARCH=um menuconfig

๋ถ€๋ถ„์ ์œผ๋กœ ๋Œ€ํ™” ์ƒ์ž๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค. ์–ธ์ œ '[Select]'์ธ ๊ฒฝ์šฐ Space ๋˜๋Š” Enter ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ‰์†Œ์™€ ๊ฐ™์ด ํ‚ค๋ณด๋“œ ํ™”์‚ดํ‘œ "์œ„" ๋ฐ "์•„๋ž˜"๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ฐฝ์„ ํƒ์ƒ‰ํ•˜๊ณ  "์™ผ์ชฝ" ๋˜๋Š” "์˜ค๋ฅธ์ชฝ" ์š”์†Œ๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

๋ณด๊ธฐ ํฌ์ธํ„ฐ โ€”>๋Š” Enter ํ‚ค๋ฅผ ๋ˆŒ๋Ÿฌ ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ๋Š” ํ•˜์œ„ ๋ฉ”๋‰ด์— ์žˆ์Œ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๊ทธ ํƒˆ์ถœ๊ตฌ๋Š” ๋ถ„๋ช…ํžˆ ''๋ฅผ ํ†ตํ•ด์„œ๋‹ค.[Exit]'.

'์— ๋‹ค์Œ ์˜ต์…˜์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค.[Select]' ์˜†์— '[*]'๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.

UML-specific Options:
  - Host filesystem
Networking support (enable this to get the submenu to show up):
  - Networking options:
    - TCP/IP Networking
UML Network devices:
  - Virtual network device
  - SLiRP transport

๊ทธ๊ฒŒ ๋‹ค์ž…๋‹ˆ๋‹ค. '๋ฅผ ์—ฐ์†์ ์œผ๋กœ ์„ ํƒํ•˜์—ฌ ์ด ์ฐฝ์„ ์ข…๋ฃŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.[Exit]'. ๋งˆ์ง€๋ง‰์— ๊ตฌ์„ฑ์„ ์ €์žฅํ•˜๋ผ๋Š” ๋ฉ”์‹œ์ง€๊ฐ€ ํ‘œ์‹œ๋˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ  '[Yes]'.

์ด ๊ฒŒ์‹œ๋ฌผ์„ ์ฝ์€ ํ›„ ์ปค๋„ ๋นŒ๋“œ ์˜ต์…˜์„ ์‚ฌ์šฉํ•ด ๋ณด๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ์‹คํ—˜์„ ํ†ตํ•ด ๋‚ฎ์€ ์ˆ˜์ค€์˜ ์ปค๋„ ๋ฉ”์ปค๋‹ˆ์ฆ˜์˜ ์ž‘๋™๊ณผ ๋‹ค์–‘ํ•œ ํ”Œ๋ž˜๊ทธ๊ฐ€ ํ•ด๋‹น ์–ด์…ˆ๋ธ”๋ฆฌ์— ๋ฏธ์น˜๋Š” ์˜ํ–ฅ์„ ์ดํ•ดํ•˜๋Š” ์ธก๋ฉด์—์„œ ๋งŽ์€ ๊ฒƒ์„ ๋ฐฐ์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ปค๋„ ๋นŒ๋“œ

Linux ์ปค๋„์€ ๋งŽ์€ ์ผ์„ ํ•˜๋Š” ํฐ ํ”„๋กœ๊ทธ๋žจ์ž…๋‹ˆ๋‹ค. ์˜ค๋ž˜๋œ ํ•˜๋“œ์›จ์–ด์—์„œ ์ด๋Ÿฌํ•œ ์ตœ์†Œํ•œ์˜ ๊ตฌ์„ฑ์„ ์‚ฌ์šฉํ•˜๋”๋ผ๋„ ๊ตฌ์ถ•ํ•˜๋Š” ๋ฐ ์ƒ๋‹นํ•œ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋‹ค์Œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์—ฌ ์ปค๋„์„ ๋นŒ๋“œํ•˜์‹ญ์‹œ์˜ค.

make ARCH=um -j$(nproc)

๋ฌด์—‡์„ ์œ„ํ•ด? ์ด ๋ช…๋ น์€ ๋นŒ๋”์—๊ฒŒ ๋นŒ๋“œ ํ”„๋กœ์„ธ์Šค์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  CPU ์ฝ”์–ด์™€ ์Šค๋ ˆ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์ง€์‹œํ•ฉ๋‹ˆ๋‹ค. ํŒ€ $(nproc) ๋นŒ๋“œ๊ฐ€ ๋๋‚˜๋ฉด ๋ช…๋ น์˜ ์ถœ๋ ฅ์„ ๋Œ€์ฒดํ•ฉ๋‹ˆ๋‹ค. nproc์˜ ์ผ๋ถ€์ธ coreutils ํ‘œ์ค€ ์šฐ๋ถ„ํˆฌ ๋นŒ๋“œ์—์„œ.

์‹œ๊ฐ„์ด ์ง€๋‚˜๋ฉด ์ปค๋„์ด ์‹คํ–‰ ํŒŒ์ผ๋กœ ์ปดํŒŒ์ผ๋ฉ๋‹ˆ๋‹ค. ./linux.

๋ฐ”์ด๋„ˆ๋ฆฌ ์„ค์น˜

Linux์˜ ์‚ฌ์šฉ์ž ๋ชจ๋“œ๋Š” ์ผ๋ฐ˜ ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•˜๋ฏ€๋กœ ๋‹ค๋ฅธ ์œ ํ‹ธ๋ฆฌํ‹ฐ์ฒ˜๋Ÿผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‚ด๊ฐ€ ํ•œ ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

mkdir -p ~/bin
cp linux ~/bin/linux

๋˜ํ•œ ๋‹ค์Œ ์‚ฌํ•ญ์„ ํ™•์ธํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ~/bin ๋‹น์‹ ์˜ $PATH:

export PATH=$PATH:$HOME/bin

๊ฒŒ์ŠคํŠธ ํŒŒ์ผ ์‹œ์Šคํ…œ ์„ค์ •

๊ฒŒ์ŠคํŠธ ํŒŒ์ผ ์‹œ์Šคํ…œ์šฉ ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

mkdir -p $HOME/prefix/uml-demo
cd $HOME/prefix

alpinelinux.org๋ฅผ ์—ด๊ณ  ๋‹ค์šด๋กœ๋“œ ์„น์…˜ ์‹ค์ œ ๋‹ค์šด๋กœ๋“œ ๋งํฌ ์ฐพ๊ธฐ MINI ROOT FILESYSTEM. ๊ธ€์„ ์“ธ ๋‹น์‹œ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์•˜์Šต๋‹ˆ๋‹ค.

http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86_64/alpine-minirootfs-3.10.0-x86_64.tar.gz

wget์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด ํƒ€๋ฅด๋ณผ์„ ๋‹ค์šด๋กœ๋“œํ•˜์‹ญ์‹œ์˜ค:

wget -O alpine-rootfs.tgz http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86_64/alpine-minirootfs-3.10.0-x86_64.tar.gz

์ด์ œ ๊ฒŒ์ŠคํŠธ ํŒŒ์ผ ์‹œ์Šคํ…œ์˜ ๋””๋ ‰ํ„ฐ๋ฆฌ์— ๋“ค์–ด๊ฐ€์„œ ์•„์นด์ด๋ธŒ๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.

cd uml-demo
tar xf ../alpine-rootfs.tgz

์„ค๋ช…๋œ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋ฉด ์ž‘์€ ํŒŒ์ผ ์‹œ์Šคํ…œ ํ…œํ”Œ๋ฆฟ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค. ์‹œ์Šคํ…œ ํŠน์„ฑ์ƒ ์•ŒํŒŒ์ธ APK ๊ด€๋ฆฌ์ž๋ฅผ ํ†ตํ•ด ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•˜๋Š” ๊ฒƒ์€ ๊ทนํžˆ ์–ด๋ ต์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด FS๋Š” ์ผ๋ฐ˜์ ์ธ ์•„์ด๋””์–ด๋ฅผ ํ‰๊ฐ€ํ•˜๊ธฐ์— ์ถฉ๋ถ„ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์šฐ๋ฆฌ๋„ ๋„๊ตฌ๊ฐ€ ํ•„์š”ํ•ด TINI ๋ฉ”๋ชจ๋ฆฌ ์†Œ๋ชจ๋ฅผ ์–ต์ œํ•˜๊ธฐ ์œ„ํ•ด ์ข€๋น„ ํ”„๋กœ์„ธ์Šค ์šฐ๋ฆฌ ๊ฒŒ์ŠคํŠธ ์ปค๋„.

wget -O tini https://github.com/krallin/tini/releases/download/v0.18.0/tini-static
chmod +x tini

์ปค๋„ ๋ช…๋ น์ค„ ๋งŒ๋“ค๊ธฐ

๋Œ€๋ถ€๋ถ„์˜ ๋‹ค๋ฅธ ํ”„๋กœ๊ทธ๋žจ๊ณผ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ Linux ์ปค๋„์—๋Š” ํ‚ค๋ฅผ ์ง€์ •ํ•˜์—ฌ ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ๋Š” ๋ช…๋ น์ค„ ์ธ์ˆ˜๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. --help.

์ž์‹  โ€”๋„์›€

linux --help
User Mode Linux v5.1.16
        available at http://user-mode-linux.sourceforge.net/

--showconfig
    Prints the config file that this UML binary was generated from.

iomem=<name>,<file>
    Configure <file> as an IO memory region named <name>.

mem=<Amount of desired ram>
    This controls how much "physical" memory the kernel allocates
    for the system. The size is specified as a number followed by
    one of 'k', 'K', 'm', 'M', which have the obvious meanings.
    This is not related to the amount of memory in the host.  It can
    be more, and the excess, if it's ever used, will just be swapped out.
        Example: mem=64M

--help
    Prints this message.

debug
    this flag is not needed to run gdb on UML in skas mode

root=<file containing the root fs>
    This is actually used by the generic kernel in exactly the same
    way as in any other kernel. If you configure a number of block
    devices and want to boot off something other than ubd0, you
    would use something like:
        root=/dev/ubd5

--version
    Prints the version number of the kernel.

umid=<name>
    This is used to assign a unique identity to this UML machine and
    is used for naming the pid file and management console socket.

con[0-9]*=<channel description>
    Attach a console or serial line to a host channel.  See
    http://user-mode-linux.sourceforge.net/old/input.html for a complete
    description of this switch.

eth[0-9]+=<transport>,<options>
    Configure a network device.
    
aio=2.4
    This is used to force UML to use 2.4-style AIO even when 2.6 AIO is
    available.  2.4 AIO is a single thread that handles one request at a
    time, synchronously.  2.6 AIO is a thread which uses the 2.6 AIO
    interface to handle an arbitrary number of pending requests.  2.6 AIO
    is not available in tt mode, on 2.4 hosts, or when UML is built with
    /usr/include/linux/aio_abi.h not available.  Many distributions don't
    include aio_abi.h, so you will need to copy it from a kernel tree to
    your /usr/include/linux in order to build an AIO-capable UML

nosysemu
    Turns off syscall emulation patch for ptrace (SYSEMU).
    SYSEMU is a performance-patch introduced by Laurent Vivier. It changes
    behaviour of ptrace() and helps reduce host context switch rates.
    To make it work, you need a kernel patch for your host, too.
    See http://perso.wanadoo.fr/laurent.vivier/UML/ for further
    information.

uml_dir=<directory>
    The location to place the pid and umid files.

quiet
    Turns off information messages during boot.

hostfs=<root dir>,<flags>,...
    This is used to set hostfs parameters.  The root directory argument
    is used to confine all hostfs mounts to within the specified directory
    tree on the host.  If this isn't specified, then a user inside UML can
    mount anything on the host that's accessible to the user that's running
    it.
    The only flag currently supported is 'append', which specifies that all
    files opened by hostfs will be opened in append mode.

์ด ํŒจ๋„์€ ์ถœ์‹œ์˜ ์ฃผ์š” ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๊ฐ•์กฐํ•ฉ๋‹ˆ๋‹ค. ์ตœ์†Œํ•œ์˜ ํ•„์ˆ˜ ์˜ต์…˜ ์„ธํŠธ๋กœ ์ปค๋„์„ ์‹คํ–‰ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

linux 
  root=/dev/root 
  rootfstype=hostfs 
  rootflags=$HOME/prefix/uml-demo 
  rw 
  mem=64M 
  init=/bin/sh

์œ„์˜ ์ค„์€ ์ปค๋„์— ๋‹ค์Œ์„ ์•Œ๋ ค์ค๋‹ˆ๋‹ค.

  • ๋ฃจํŠธ ํŒŒ์ผ ์‹œ์Šคํ…œ์ด ์˜์‚ฌ ์žฅ์น˜๋ผ๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค. /dev/root.
  • ๊ณ ๋ฅด๋‹ค ํ˜ธ์ŠคํŠธ ๋ฃจํŠธ ํŒŒ์ผ ์‹œ์Šคํ…œ ๋“œ๋ผ์ด๋ฒ„๋กœ.
  • ๋ฃจํŠธ ์žฅ์น˜์— ์ƒ์„ฑํ•œ ๊ฒŒ์ŠคํŠธ ํŒŒ์ผ ์‹œ์Šคํ…œ์„ ๋งˆ์šดํŠธํ•ฉ๋‹ˆ๋‹ค.
  • ๊ทธ๋ฆฌ๊ณ  ์˜ˆ, ์ฝ๊ธฐ-์“ฐ๊ธฐ ๋ชจ๋“œ์ž…๋‹ˆ๋‹ค.
  • RAM์€ 64MB๋งŒ ์‚ฌ์šฉํ•˜์„ธ์š”(๊ณ„ํš์— ๋”ฐ๋ผ ํ›จ์”ฌ ์ ๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ์ง€๋งŒ 64MB๊ฐ€ ์ตœ์ ์˜ ์–‘์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค).
  • ์ปค๋„์ด ์ž๋™์œผ๋กœ ์‹œ์ž‘๋ฉ๋‹ˆ๋‹ค /bin/sh ะบะฐะบ init-ํ”„๋กœ์„ธ์Šค.

์ด ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜ํƒ€๋‚ฉ๋‹ˆ๋‹ค.

ํ•œ ์žฅ ๋”

Core dump limits :
        soft - 0
        hard - NONE
Checking that ptrace can change system call numbers...OK
Checking syscall emulation patch for ptrace...OK
Checking advanced syscall emulation patch for ptrace...OK
Checking environment variables for a tempdir...none found
Checking if /dev/shm is on tmpfs...OK
Checking PROT_EXEC mmap in /dev/shm...OK
Adding 32137216 bytes to physical memory to account for exec-shield gap
Linux version 5.1.16 (cadey@kahless) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #30 Sun Jul 7 18:57:19 UTC 2019
Built 1 zonelists, mobility grouping on.  Total pages: 23898
Kernel command line: root=/dev/root rootflags=/home/cadey/dl/uml/alpine rootfstype=hostfs rw mem=64M init=/bin/sh
Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
Memory: 59584K/96920K available (2692K kernel code, 708K rwdata, 588K rodata, 104K init, 244K bss, 37336K reserved, 0K cma-reserved)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS: 15
clocksource: timer: mask: 0xffffffffffffffff max_cycles: 0x1cd42e205, max_idle_ns: 881590404426 ns
Calibrating delay loop... 7479.29 BogoMIPS (lpj=37396480)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
Checking that host ptys support output SIGIO...Yes
Checking that host ptys support SIGIO on close...No, enabling workaround
devtmpfs: initialized
random: get_random_bytes called from setup_net+0x48/0x1e0 with crng_init=0
Using 2.6 host AIO
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 256 (order: 0, 6144 bytes)
NET: Registered protocol family 16
clocksource: Switched to clocksource timer
NET: Registered protocol family 2
tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 1, 8192 bytes)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
NET: Registered protocol family 1
console [stderr0] disabled
mconsole (version 2) initialized on /home/cadey/.uml/tEwIjm/mconsole
Checking host MADV_REMOVE support...OK
workingset: timestamp_bits=62 max_order=14 bucket_order=0
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered (default)
io scheduler bfq registered
loop: module loaded
NET: Registered protocol family 17
Initialized stdio console driver
Using a channel type which is configured out of UML
setup_one_line failed for device 1 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 2 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 3 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 4 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 5 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 6 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 7 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 8 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 9 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 10 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 11 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 12 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 13 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 14 : Configuration failed
Using a channel type which is configured out of UML
setup_one_line failed for device 15 : Configuration failed
Console initialized on /dev/tty0
console [tty0] enabled
console [mc-1] enabled
Failed to initialize ubd device 0 :Couldn't determine size of device's file
VFS: Mounted root (hostfs filesystem) on device 0:11.
devtmpfs: mounted
This architecture does not have kernel memory protection.
Run /bin/sh as init process
/bin/sh: can't access tty; job control turned off
random: fast init done
/ # 

์œ„์˜ ์กฐ์ž‘์„ ํ†ตํ•ด ์šฐ๋ฆฌ๋Š” ์ตœ์†Œํ•œ ๊ฒŒ์ŠคํŠธ ์‹œ์Šคํ…œ, ๊ทธ๋Ÿฐ ๊ฒƒ ์—†์ด /proc ๋˜๋Š” ํ• ๋‹น๋œ ํ˜ธ์ŠคํŠธ ์ด๋ฆ„. ์˜ˆ๋ฅผ ๋“ค์–ด ๋‹ค์Œ ๋ช…๋ น์„ ์‹œ๋„ํ•ด ๋ณด์‹ญ์‹œ์˜ค.

- uname -av
- cat /proc/self/pid
- hostname

๊ฒŒ์ŠคํŠธ์—์„œ ๋กœ๊ทธ์•„์›ƒํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ์ž…๋ ฅํ•˜์„ธ์š”. exit ๋˜๋Š” Ctrl-d๋ฅผ ๋ˆ„๋ฅด์„ธ์š”. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ์‰˜์ด ์ข…๋ฃŒ๋˜๊ณ  ์ปค๋„ ํŒจ๋‹‰์ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

/ # exit
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
fish: โ€œ./linux root=/dev/root rootflagโ€ฆโ€ terminated by signal SIGABRT (Abort)

Linux ์ปค๋„์€ ์ดˆ๊ธฐํ™” ํ”„๋กœ์„ธ์Šค๊ฐ€ ํ•ญ์ƒ ์‹คํ–‰ ์ค‘์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๋Ÿฌํ•œ ์ปค๋„ ํŒจ๋‹‰์ด ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์ด ์—†์œผ๋ฉด ์‹œ์Šคํ…œ์€ ๋” ์ด์ƒ ์ž‘๋™ํ•  ์ˆ˜ ์—†์œผ๋ฉฐ ์ถฉ๋Œ์ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด๋Š” ์‚ฌ์šฉ์ž ๋ชจ๋“œ ํ”„๋กœ์„ธ์Šค์ด๋ฏ€๋กœ ๊ฒฐ๊ณผ ์ถœ๋ ฅ์€ ๋‹ค์Œ์œผ๋กœ ์ „์†ก๋ฉ๋‹ˆ๋‹ค. SIGABRT, ๊ฒฐ๊ณผ์ ์œผ๋กœ ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

๊ฒŒ์ŠคํŠธ ๋„คํŠธ์›Œํฌ ์„ค์ •

๊ทธ๋ฆฌ๊ณ  ์—ฌ๊ธฐ์„œ๋ถ€ํ„ฐ ์ผ์ด ์ž˜๋ชป๋˜๊ธฐ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ๋ชจ๋“œ์—์„œ์˜ ๋„คํŠธ์›Œํ‚น Linux๋Š” ์ œํ•œ๋œ "์‚ฌ์šฉ์ž ๋ชจ๋“œ"์˜ ์ „์ฒด ๊ฐœ๋…์ด ๋ฌด๋„ˆ์ง€๊ธฐ ์‹œ์ž‘ํ•˜๋Š” ๊ณณ์ž…๋‹ˆ๋‹ค. ๊ฒฐ๊ตญ ์ผ๋ฐ˜์ ์œผ๋กœ ์‹œ์Šคํ…œ ์ˆ˜์ค€์—์„œ๋Š” ๋„คํŠธ์›Œํฌ๊ฐ€ ์ œํ•œ๋ฉ๋‹ˆ๋‹ค. ํŠน๊ถŒ์„ ๋ฐ›์€ ์šฐ๋ฆฌ ๋ชจ๋‘๊ฐ€ ์ดํ•ดํ•  ์ˆ˜ ์žˆ๋Š” ์ด์œ ๋กœ ์‹คํ–‰ ๋ชจ๋“œ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

๋ฉ”๋ชจ. per .: UML์—์„œ ๋„คํŠธ์›Œํฌ ์ž‘์—…์„ ์œ„ํ•œ ๋‹ค์–‘ํ•œ ์˜ต์…˜์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์ฝ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—.

์Šฌ๋ฆฝ์œผ๋กœ์˜ ์—ฌํ–‰

๊ทธ๋Ÿฌ๋‚˜ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜ค๋ž˜๋˜๊ณ  ๊ฑฐ์˜ ์ง€์›๋˜์ง€ ์•Š๋Š” ๋„๊ตฌ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์Šฌ๋ฆฝ, ์‚ฌ์šฉ์ž ๋ชจ๋“œ Linux๊ฐ€ ๋„คํŠธ์›Œํฌ์™€ ์ƒํ˜ธ ์ž‘์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์‚ฌ์šฉ์ž ์ˆ˜์ค€ TCP/IP ์Šคํƒ๊ณผ ๋งค์šฐ ์œ ์‚ฌํ•˜๊ฒŒ ์ž‘๋™ํ•˜๋ฉฐ ์‹คํ–‰ํ•˜๋Š” ๋ฐ ์‹œ์Šคํ…œ ๊ถŒํ•œ์ด ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด ๋„๊ตฌ๋Š” 1995๋…„ ์ถœ์‹œ, ์ตœ์‹  ์—…๋ฐ์ดํŠธ ๋‚ ์งœ๊ฐ€ ์ง€์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. 2006 ์—ฐ๋„. ์Šฌ๋ฆฝ์€ ์•„์ฃผ ์˜ค๋ž˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ง€์›๊ณผ ์—…๋ฐ์ดํŠธ๊ฐ€ ์—†๋Š” ๋™์•ˆ ์ปดํŒŒ์ผ๋Ÿฌ๋Š” ์ง€๊ธˆ๊นŒ์ง€ ์ด ๋„๊ตฌ๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์„ค๋ช…ํ•  ์ˆ˜ ์žˆ์„ ์ •๋„๋กœ ๋ฐœ์ „ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ฝ”๋“œ ๋ถ€ํŒจ.

์ด์ œ Ubuntu ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์—์„œ Slirp๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์‹คํ–‰ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

sudo apt-get install slirp
/usr/bin/slirp
Slirp v1.0.17 (BETA)

Copyright (c) 1995,1996 Danny Gasparovski and others.
All rights reserved.
This program is copyrighted, free software.
Please read the file COPYRIGHT that came with the Slirp
package for the terms and conditions of the copyright.

IP address of Slirp host: 127.0.0.1
IP address of your DNS(s): 1.1.1.1, 10.77.0.7
Your address is 10.0.2.15
(or anything else you want)

Type five zeroes (0) to exit.

[autodetect SLIP/CSLIP, MTU 1500, MRU 1500, 115200 baud]

SLiRP Ready ...
fish: โ€œ/usr/bin/slirpโ€ terminated by signal SIGSEGV (Address boundary error)

์˜ค ๋ง™์†Œ์‚ฌ. Slirp์˜ ๋””๋ฒ„๊ฑฐ๋ฅผ ์„ค์น˜ํ•˜๊ณ  ์—ฌ๊ธฐ์„œ ๋ฌด์Šจ ์ผ์ด ์ผ์–ด๋‚˜๊ณ  ์žˆ๋Š”์ง€ ์•Œ์•„ ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

sudo apt-get install gdb slirp-dbgsym
gdb /usr/bin/slirp
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/slirp...Reading symbols from /usr/lib/debug/.build-id/c6/2e75b69581a1ad85f72ac32c0d7af913d4861f.debug...done.
done.
(gdb) run
Starting program: /usr/bin/slirp
Slirp v1.0.17 (BETA)

Copyright (c) 1995,1996 Danny Gasparovski and others.
All rights reserved.
This program is copyrighted, free software.
Please read the file COPYRIGHT that came with the Slirp
package for the terms and conditions of the copyright.

IP address of Slirp host: 127.0.0.1
IP address of your DNS(s): 1.1.1.1, 10.77.0.7
Your address is 10.0.2.15
(or anything else you want)

Type five zeroes (0) to exit.

[autodetect SLIP/CSLIP, MTU 1500, MRU 1500, 115200 baud]

SLiRP Ready ...

Program received signal SIGSEGV, Segmentation fault.
                                                    ip_slowtimo () at ip_input.c:457
457     ip_input.c: No such file or directory.

์˜ค๋ฅ˜๊ฐ€ ์šฐ๋ฆฌ๋ฅผ ์ด๊ธด๋‹ค ์ด ์ค„. ์Šคํƒ ์ถ”์ ์„ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์•„๋งˆ๋„ ๋ญ”๊ฐ€ ๋„์›€์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

(gdb) bt full
#0  ip_slowtimo () at ip_input.c:457
        fp = 0x55784a40
#1  0x000055555556a57c in main_loop () at ./main.c:980
        so = <optimized out>
        so_next = <optimized out>
        timeout = {tv_sec = 0, tv_usec = 0}
        ret = 0
        nfds = 0
        ttyp = <optimized out>
        ttyp2 = <optimized out>
        best_time = <optimized out>
        tmp_time = <optimized out>
#2  0x000055555555b116 in main (argc=1, argv=0x7fffffffdc58) at ./main.c:95
No locals.

์—ฌ๊ธฐ์„œ๋Š” slirp๊ฐ€ ์‹œ๊ฐ„ ์ดˆ๊ณผ๋ฅผ ํ™•์ธํ•˜๋ ค๊ณ  ํ•  ๋•Œ ๋ฉ”์ธ ๋ฃจํ”„ ์‹œ์ž‘ ์ค‘์— ์ถฉ๋Œ์ด ๋ฐœ์ƒํ•˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ์‹œ์ ์—์„œ ์ €๋Š” ๋””๋ฒ„๊น…์„ ํฌ๊ธฐํ•ด์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ Sort๋กœ ๊ตฌ์ถ•๋œ Slirp๊ฐ€ ์ž‘๋™ํ•˜๋Š”์ง€ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ์—์„œ ์ง์ ‘ ์•„์นด์ด๋ธŒ๋ฅผ ๋‹ค์‹œ ๋‹ค์šด๋กœ๋“œํ–ˆ์Šต๋‹ˆ๋‹ค. ์†Œ์Šค ํฌ์ง€, ๋ช…๋ น์ค„์„ ํ†ตํ•ด ๊ฑฐ๊ธฐ์—์„œ ๋ฌด์–ธ๊ฐ€๋ฅผ ๋“œ๋ž˜๊ทธํ•˜๋Š” ๊ฒƒ์€ ๊ณ ํ†ต์Šค๋Ÿฝ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

cd ~/dl
wget https://xena.greedo.xeserv.us/files/slirp-1.0.16.tar.gz
tar xf slirp-1.0.16.tar.gz
cd slirp-1.0.16/src
./configure --prefix=$HOME/prefix/slirp
make

์—ฌ๊ธฐ์„œ๋Š” ์ •์˜๋˜์ง€ ์•Š์€ ๋‚ด์žฅ ํ•จ์ˆ˜, ์ฆ‰ ๊ฒฐ๊ณผ ๋ฐ”์ด๋„ˆ๋ฆฌ ํŒŒ์ผ์„ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†๋‹ค๋Š” ๊ฒฝ๊ณ ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 2006๋…„๋ถ€ํ„ฐ ์ด ์‹œ์ ๊นŒ์ง€ gcc๋Š” ์ค‘๊ฐ„ ์ปดํŒŒ์ผ ํŒŒ์ผ์˜ ๋‚ด์žฅ ํ•จ์ˆ˜์— ์‚ฌ์šฉ๋˜๋Š” ๊ธฐํ˜ธ ์ƒ์„ฑ์„ ์ค‘๋‹จํ•œ ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค. ํ‚ค์›Œ๋“œ๋ฅผ ๋ฐ”๊ฟ”๋ณด์ž inline ๋นˆ ์ฃผ์„์— ๋Œ€ํ•ด ๊ฒฐ๊ณผ๋ฅผ ์‚ดํŽด๋ณด์‹ญ์‹œ์˜ค.

vi slirp.h
:6
a
<enter>
#define inline /**/
<escape>
:wq
make

์•„๋‹ˆ์š”. ์ด๊ฒƒ๋„ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์•„์ง๋„ ์ด๋Ÿฌํ•œ ๊ธฐ๋Šฅ์— ๋Œ€ํ•œ ๊ธฐํ˜ธ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

์ด ์‹œ์ ์—์„œ ๋‚˜๋Š” ํฌ๊ธฐํ•˜๊ณ  Github์„ ์ฐพ๊ธฐ ์‹œ์ž‘ํ–ˆ์Šต๋‹ˆ๋‹ค. Heroku ๋นŒ๋“œ ํŒจํ‚ค์ง€. ๋‚ด ์ด๋ก ์€ ์ผ๋ถ€ Heroku ๋นŒ๋“œ ํŒจํ‚ค์ง€์— ๋‚ด๊ฐ€ ํ•„์š”ํ•œ ๋ฐ”์ด๋„ˆ๋ฆฌ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ฒฐ๊ตญ ๊ฒ€์ƒ‰์ด ๋‚˜๋ฅผ ์ด๋Œ์—ˆ์Šต๋‹ˆ๋‹ค ์—ฌ๊ธฐ. ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์••์ถ•์„ ํ’€์—ˆ์Šต๋‹ˆ๋‹ค. uml.tar.gz ๊ทธ๋ฆฌ๊ณ  ๋‹ค์Œ์„ ๋ฐœ๊ฒฌํ–ˆ์Šต๋‹ˆ๋‹ค:

total 6136
-rwxr-xr-x 1 cadey cadey   79744 Dec 10  2017 ifconfig*
-rwxr-xr-x 1 cadey cadey     373 Dec 13  2017 init*
-rwxr-xr-x 1 cadey cadey  149688 Dec 10  2017 insmod*
-rwxr-xr-x 1 cadey cadey   66600 Dec 10  2017 route*
-rwxr-xr-x 1 cadey cadey  181056 Jun 26  2015 slirp*
-rwxr-xr-x 1 cadey cadey 5786592 Dec 15  2017 uml*
-rwxr-xr-x 1 cadey cadey     211 Dec 13  2017 uml_run*

์ด๊ฒƒ์ด ๋ฐ”๋กœ ์Šฌ๋ฆฝ ๋ฐ”์ด๋„ˆ๋ฆฌ์ž…๋‹ˆ๋‹ค! ๊ทธ ์‚ฌ๋žŒ ์ผํ•ด์š”?

./slirp
Slirp v1.0.17 (BETA) FULL_BOLT

Copyright (c) 1995,1996 Danny Gasparovski and others.
All rights reserved.
This program is copyrighted, free software.
Please read the file COPYRIGHT that came with the Slirp
package for the terms and conditions of the copyright.

IP address of Slirp host: 127.0.0.1
IP address of your DNS(s): 1.1.1.1, 10.77.0.7
Your address is 10.0.2.15
(or anything else you want)

Type five zeroes (0) to exit.

[autodetect SLIP/CSLIP, MTU 1500, MRU 1500]

SLiRP Ready ...

์ถฉ๋Œํ•˜์ง€ ์•Š์œผ๋ฏ€๋กœ ์ž‘๋™ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค! ์ด ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ์‹ฌ์ž ~/bin/slirp:

cp slirp ~/bin/slirp

ํŒจํ‚ค์ง€ ์ž‘์„ฑ์ž๊ฐ€ ์ด๋ฅผ ์ œ๊ฑฐํ•œ ๊ฒฝ์šฐ์—๋Š” ๊ฑฐ์šธ์„ ๋งŒ๋“ค์—ˆ์–ด์š”.

๋„คํŠธ์›Œํฌ ๊ตฌ์„ฑ

์ด์ œ ๊ฒŒ์ŠคํŠธ ์ปค๋„์— ๋„คํŠธ์›Œํฌ๋ฅผ ์„ค์ •ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์‹คํ–‰ ์˜ต์…˜ ์—…๋ฐ์ดํŠธ:

linux 
  root=/dev/root 
  rootfstype=hostfs 
  rootflags=$HOME/prefix/uml-demo 
  rw 
  mem=64M 
  eth0=slirp,,$HOME/bin/slirp 
  init=/bin/sh

์ด์ œ ๋„คํŠธ์›Œํฌ๋ฅผ ์ผœ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

mount -t proc proc proc/
mount -t sysfs sys sys/

ifconfig eth0 10.0.2.14 netmask 255.255.255.240 broadcast 10.0.2.15
route add default gw 10.0.2.2

์ฒ˜์Œ ๋‘ ๊ฐœ์˜ ๊ตฌ์„ฑ ๋ช…๋ น /proc ะธ /sys ์—…๋ฌด์— ๊ผญ ํ•„์š”ํ•œ ifconfig, Slirp์™€ ํ†ต์‹ ํ•  ๋„คํŠธ์›Œํฌ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ํŒ€ route ๋ชจ๋“  ํŠธ๋ž˜ํ”ฝ์ด Slirp ํ„ฐ๋„์„ ํ†ตํ•ด ์ „์†ก๋˜๋„๋ก ์ปค๋„ ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ”์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. DNS ์ฟผ๋ฆฌ๋ฅผ ํ†ตํ•ด ์ด๋ฅผ ํ™•์ธํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

nslookup google.com 8.8.8.8
Server:    8.8.8.8
Address 1: 8.8.8.8 dns.google

Name:      google.com
Address 1: 172.217.12.206 lga25s63-in-f14.1e100.net
Address 2: 2607:f8b0:4006:81b::200e lga25s63-in-x0e.1e100.net

๊ทธ๊ฒƒ์€ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค!

์ฐธ๊ณ  ์‚ฌํ•ญ: ์›๋ณธ ๊ฒŒ์‹œ๋ฌผ์€ ์œ ์„  ๋„คํŠธ์›Œํฌ ์นด๋“œ๊ฐ€ ์žˆ๋Š” ๋ฐ์Šคํฌํƒ‘์ด๋‚˜ ์ถ”๊ฐ€ ๋“œ๋ผ์ด๋ฒ„๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š์€ ๊ธฐํƒ€ ๊ตฌ์„ฑ์—์„œ ์ž‘์„ฑ๋œ ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค. Intel์˜ WiFi 8265๊ฐ€ ํƒ‘์žฌ๋œ ๋…ธํŠธ๋ถ์—์„œ ๋„คํŠธ์›Œํฌ๋ฅผ ์˜ฌ๋ฆด ๋•Œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

/ # ifconfig eth0 10.0.2.14 netmask 255.255.255.240 broadcast 10.0.2.15
slirp_tramp failed - errno = 2
ifconfig: ioctl 0x8914 failed: No such file or directory
/ #

๋ถ„๋ช…ํžˆ ์ปค๋„์€ ๋„คํŠธ์›Œํฌ ์นด๋“œ ๋“œ๋ผ์ด๋ฒ„์™€ ํ†ต์‹ ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋ถˆํ–‰ํ•˜๊ฒŒ๋„ ํŽŒ์›จ์–ด๋ฅผ ์ปค๋„๋กœ ์ปดํŒŒ์ผํ•˜๋ ค๊ณ  ์‹œ๋„ํ–ˆ์ง€๋งŒ ์ƒํ™ฉ์ด ํ•ด๊ฒฐ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ์ถœํŒ ๋‹น์‹œ์—๋Š” ์ด ๊ตฌ์„ฑ์—์„œ ์†”๋ฃจ์…˜์„ ์ฐพ์„ ์ˆ˜ ์—†์—ˆ์Šต๋‹ˆ๋‹ค. ๋” ๊ฐ„๋‹จํ•œ ๊ตฌ์„ฑ(์˜ˆ: Virtualbox)์—์„œ๋Š” ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ƒ์Šนํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ ์‰˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฆฌ๋””๋ ‰์…˜์„ ์ž๋™ํ™”ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

#!/bin/sh
# init.sh

mount -t proc proc proc/
mount -t sysfs sys sys/
ifconfig eth0 10.0.2.14 netmask 255.255.255.240 broadcast 10.0.2.15
route add default gw 10.0.2.2

echo "networking set up"

exec /tini /bin/sh

๊ทธ๋ฆฌ๊ณ  ์‹คํ–‰ ๊ฐ€๋Šฅ์œผ๋กœ ํ‘œ์‹œํ•˜์‹ญ์‹œ์˜ค.

chmod +x init.sh

๊ทธ๋Ÿฐ ๋‹ค์Œ ์ปค๋„ ๋ช…๋ น์ค„์„ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.

linux 
  root=/dev/root 
  rootfstype=hostfs 
  rootflags=$HOME/prefix/uml-demo 
  rw 
  mem=64M 
  eth0=slirp,,$HOME/bin/slirp 
  init=/init.sh

๊ทธ๋ฆฌ๊ณ  ๋ฐ˜๋ณตํ•ด๋ณด์ž:

SLiRP Ready ...
networking set up
/bin/sh: can't access tty; job control turned off

nslookup google.com 8.8.8.8
Server:    8.8.8.8
Address 1: 8.8.8.8 dns.google

Name:      google.com
Address 1: 172.217.12.206 lga25s63-in-f14.1e100.net
Address 2: 2607:f8b0:4004:800::200e iad30s09-in-x0e.1e100.net

๋„คํŠธ์›Œํฌ๊ฐ€ ์•ˆ์ •์ ์ž…๋‹ˆ๋‹ค!

๋„์ปค ํŒŒ์ผ

์ด ๋ชจ๋“  ๊ฒƒ์„ ๋” ์‰ฝ๊ฒŒ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋„๋ก ์ˆ˜์ง‘ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋„์ปค ํŒŒ์ผ, ์„ค๋ช…๋œ ๋Œ€๋ถ€๋ถ„์˜ ๋‹จ๊ณ„๋ฅผ ์ž๋™ํ™”ํ•˜๊ณ  ์ž‘์—… ๊ตฌ์„ฑ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋‚˜ ๋˜ํ•œ ์‚ฌ์ „ ๊ตฌ์„ฑ๋œ ์ปค๋„, ๊ฒŒ์‹œ๋ฌผ์— ์„ค๋ช…๋œ ๋ชจ๋“  ๋‚ด์šฉ์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์—ฌ๊ธฐ์„œ๋Š” ์ตœ์†Œ ์„ค์ •๋งŒ ์„ค๋ช…ํ–ˆ๋‹ค๋Š” ์ ์„ ์ดํ•ดํ•˜๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค.

์ด ๊ฒŒ์‹œ๋ฌผ์ด ๊ฒŒ์ŠคํŠธ ์ปค๋„์„ ํ‚ค์šฐ๋Š” ๋ฐฉ๋ฒ•์„ ์ดํ•ดํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋˜์—ˆ๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค. ๊ทธ๊ฒƒ์€ ์ผ์ข…์˜ ๊ดด๋ฌผ๋กœ ํŒ๋ช…๋˜์—ˆ์ง€๋งŒ ์ด ์ถœํŒ๋ฌผ์€ ์ด ์ œํ’ˆ๊ตฐ์˜ ์ตœ์‹  ๋ฒ„์ „ ์šด์˜ ์ฒด์ œ์—์„œ Linux์—์„œ ์‚ฌ์šฉ์ž ๋ชจ๋“œ๋ฅผ ๊ตฌ์ถ•, ์„ค์น˜ ๋ฐ ๊ตฌ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ํฌ๊ด„์ ์ธ ๊ฐ€์ด๋“œ๋กœ ์ƒ๊ฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ๋‹จ๊ณ„์—๋Š” ์ด๋ฏธ ๊ฒŒ์ŠคํŠธ ์‹œ์Šคํ…œ ๋‚ด์— ์„œ๋น„์Šค ๋ฐ ๊ธฐํƒ€ ์†Œํ”„ํŠธ์›จ์–ด๋ฅผ ์„ค์น˜ํ•˜๋Š” ์ž‘์—…์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. Docker ์ปจํ…Œ์ด๋„ˆ ์ด๋ฏธ์ง€๋Š” ๊ณต๊ฐœ๋œ tarball์ด๋ฏ€๋กœ ๋‹ค์Œ์„ ํ†ตํ•ด ์ด๋ฏธ์ง€๋ฅผ ์ถ”์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. docker export๋ฅผ ํด๋ฆญํ•œ ๋‹ค์Œ ๊ฒŒ์ŠคํŠธ ์ปค๋„ ํŒŒ์ผ ์‹œ์Šคํ…œ์˜ ๋ฃจํŠธ์—์„œ ์„ค์น˜ ๊ฒฝ๋กœ๋ฅผ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ ์‰˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์‹ญ์‹œ์˜ค.

Freenode์˜ #lobsters์˜ Rkeene์—๊ฒŒ ํŠน๋ณ„ํžˆ ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค. Slirp๋ฅผ ๋””๋ฒ„๊น…ํ•˜๋Š” ๊ทธ์˜ ๋„์›€์ด ์—†์—ˆ๋‹ค๋ฉด ๋‚˜๋Š” ์—ฌ๊ธฐ๊นŒ์ง€ ๋„๋‹ฌํ•˜์ง€ ๋ชปํ–ˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋‚˜๋Š” ๊ทธ์˜ Slackware ์‹œ์Šคํ…œ์ด slirp์™€ ์–ด๋–ป๊ฒŒ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ž‘๋™ํ•˜๋Š”์ง€ ์ „ํ˜€ ๋ชจ๋ฅด์ง€๋งŒ ๋‚ด Ubuntu์™€ Alpine ์‹œ์Šคํ…œ์€ slirp์™€ Rkeene์ด ๋‚˜์—๊ฒŒ ์ œ์•ˆํ•œ ๋ฐ”์ด๋„ˆ๋ฆฌ๋ฅผ ํ—ˆ์šฉํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ ์–ด๋„ ๋‚˜์—๊ฒŒ ๋ญ”๊ฐ€๊ฐ€ ํšจ๊ณผ๊ฐ€ ์žˆ๋‹ค๋Š” ๊ฒƒ๋งŒ์œผ๋กœ๋„ ์ถฉ๋ถ„ํ•ฉ๋‹ˆ๋‹ค.

์ถœ์ฒ˜ : habr.com

์ฝ”๋ฉ˜ํŠธ๋ฅผ ์ถ”๊ฐ€