Appendix III. Ubuntu 개발환경 구축하기

1. Windows 10 + Ubuntu Dual Boot 설치하기

1. UEFI 부팅 지원을 위한 GPT 포맷으로 변경하기

  1. Window Technet 방법 참조

Converting Windows BIOS installation to UEFI There are several reasons to use UEFI instead of BIOS. I won't go into details regarding that. But there are some cases when you already have a fully functional Windows installation running on BIOS and you don't want to start all over again. Sadly, there are no tools that performs this job. And I found there is not too much documentation regarding how this can be performed either, or even how this should work. Since after some digging and trial-and-error I was able to perform the operation, I will post the instructions for anyone who needs it.

Please note this is not supported by Microsoft.

Table of Contents Goal Prerequisites Warnings Recommendations Notes Instructions Troubleshooting Final tasks

Goal

Convert a Windows 7/8 BIOS (MBR) installation to UEFI (GPT) without moving, copying or losing data.

Prerequisites

A computer able to boot UEFI. You can check that on your computer manufacturer. Also in the BIOS setup should display UEFI boot options. Windows 7/8 x64 (I'm not sure if x86 supports it or how). A computer able to boot from USB or memory card (only for this process). A USB drive or memory card with at least 4GB or a Windows installation disc. BitLocker TURNED OFF! If you have BitLocker enabled on your hard drive, it will have to be TOTALLY turned off for this procedure. After the procedure is performed, BitLocker can be turned on again. A "standard" Windows installation. This means, the disk where Windows is installed has to contain the System Partition (something above 200MB) and then the OS Partition. This is because Windows will require some space at the beginning of the disk to create the new boot partitions, and we will use the previous System Partition. To verify this you can follow Instructions steps 8 through 11. If there isn't enough space at the beginning (the primary small partition is under 200MB), partitions may be resized using some tool like Easeus Partition Master (You can also just use the windows disk management tool (diskmgmt.msc)) or such. Don't continue the operation until you have done so because you may not be able to finish it!

Warnings

As usually, I won't take any responsibilities if data is being lost, your computer doesn't boot up anymore, or some gremlins attack your family. You are doing this at your own responsibility. :) This is not a documented feature at all. After this procedure, old versions of Windows probably won't be able to boot from this disk drive since it has to be converted to GPT.

Recommendations

It is HIGHLY recommended for you to perform a backup of your data! If you have a second disk drive big enough, you can simply create a system image and able to recover the full installation as it was before you started this procedure if anything goes wrong. Download this guide to another computer or print it out, since you will have to make some operations without Windows working. These procedures are likely to render your on-board Recovery partition unusable. Thus, a backup of your Recovery partition onto a USB device is highly recommended if your PC came with Windows 8 preinstalled or you don't have your Windows installation media. Once created, this bootable Recovery USB can optionally be substituted for the System Repair disc in the steps below. For a creating the Recovery USB, see the following: http://www.techrepublic.com/blog/window-on-windows/create-a-recovery-drive-in-windows-8/7261 This link is external to TechNet Wiki. It will open in a new window.

Notes

Steps were performed on Windows 8. Some steps in Windows 7 may have different menus, but the options and results are the same.

Instructions

Create a system repair disc (http://windows.microsoft.com/en-US/windows7/Create-a-system-repair-disc This link is external to TechNet Wiki. It will open in a new window. ). You can skip this step if you have a Windows installation media. Is a good measure to reboot and verify you can start your system from this disc. Identify which disk you want to convert (usually is #0). This can be done by looking at the number in the Windows Disk Management. Download gptgen from here http://sourceforge.net/projects/gptgen This link is external to TechNet Wiki. It will open in a new window. . (You could use the Windows Disk Management Tool for this too. (diskmgmt.msc)) This tool will allow you to convert your MBR disc to GPT with the data included. ATTENTION: After this step, your computer CANNOT BOOT until the whole process is completed. DO NOT Shut Down Unless Instructed to! Unzip gptgen and then run CMD with elevated privileges. (replace the 0 with the identified disk number).

This will result in a BSOD shortly after and it's to be expected:

gptgen.exe -w \.\physicaldrive0

Boot using your Windows installation or previously generated system repair disc. Choose language and preferences, and then select Repair Your Computer -> Troubleshoot -> Advanced options -> Command Prompt (Hotkey: Shift + F10) We will need the disk partitioning tool. With this, we will recreate the boot partitions. Type: diskpart

Identify the boot disk where Windows is located, typing: list disk

Something like this should appear:

  Disk ###  Status         Size     Free     Dyn  Gpt

  --------  -------------  -------  -------  ---  ---

* Disk 0    Online          128 GB      0 B        *

Once identified, select the disk (replace with the correct number): select disk 0

Verify the partitions: list partition

Something similar at the info below should appear. Partition ### Type Size Offset

   -------------  ----------------  -------  -------

   Partition 1    Primary            350 MB  1024 KB

   Partition 2    Primary            126 GB   350 MB

Delete the previous system partition: select partition 1

delete partition

Create the new boot partition, Microsoft reserved partition: create partition EFI size=100 offset=1

format quick fs=fat32 label="System"

assign letter=S

create partition msr size=128 offset=103424

If you list the partitions again, you should have ended up with something like this: Partition ### Type Size Offset

   -------------  ----------------  -------  -------

   Partition 1    System             100 MB  1024 KB

   Partition 2    Reserved           128 MB   101 MB

   Partition 3    Primary            126 GB   229 MB

Ensure that your Windows installation is mounted, replacing 3 with the volume number of the Windows installation (usually 1): list volume

select volume 3

assign letter=C

Exit diskpart: exit

Generate boot partition data, replacing C: with the letter of the Windows installation (usually C:): bcdboot c:\windows /s s: /f UEFI

Cross your fingers and then restart your computer!

Troubleshooting

In the event that you get:

BOOTMGR is missing

press CTRL+ALT+DEL to Restart

Follow these steps

  1. Partition Wizard Tool 사용

Windoes 10 클린 설치

영문윈도우에서 노트북 한글 키보드 설정

  1. 윈도우 시작메뉴 실행창에 regedit 을 입력하여 실행한다.
  2. 레지스트리 편집기 왼쪽의 폴더 트리에서 "내컴퓨터\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters" 에 들어간다.
  3. 레지스트리 편집기 우측 화면에 있는 것들 중에 3-1. LayerDriver KOR 더블클릭 kbd103.dll 을 kbd101a.dll 로 변경 3-2. OverrideKeyboardIdentifer 더블클릭 PCAT_103Key 를 PCAT_101aKey 로 변경 3-3. OverrideKeyboardSubtype 더블클릭 6 에서 3 으로 변경 3-3. OverrideKeyboardType 우측에 보이는 값이 8이면 그냥 두고 8이 아니면 더블클릭 하여 8로 변경

2) Dual Boot 환경으로 Ubuntu 설치하기

  1. USB를 꽂은 체로 PC 또는 노트북의 전원을 킵니다.

바로 BIOS에 진입할 수 있게 각 제조사 별 BIOS 진입 키를 눌러서 진입해주세요.

진입하셔서 Boot 탭에서 Boot Device Priority 엔터

  1. Boot Option #1 에 보시면 Windows로 잡혀있습니다.

해당 부분을 엔터하셔서 USB 이름으로 된 부분을 설정하여 줍니다.

바로 이렇게 말이죠.

  1. 저장 후 종료 합니다.
  1. 그러면 자동적으로 우분투 GRUB으로 넘어갑니다.

맨 상단의 Try Ubuntu without installing 엔터

  1. 설치없이 우분투 환경을 사용해 볼 수 있습니다.

여기서 진행하는 이유는 인터넷으로 찾아보면서 진행 할 수 있기 때문이죠.

  1. 바탕화면의 'Install Ubuntu 14.04.3 LTS' 를 실행시킵니다.
  1. 초기 언어는 '한국어'로 설정
  1. 별 무리없이 계속 클릭
  1. '설치 형식'에서 '기타'를 선택 후 계속
  1. 윈도우에서 파티션 분할해둔 남은 공간을 확인 하세요.

위 공간을 선택 하신 후, + 버튼을 클릭합니다.

  1. 먼저, Swap 영역을 만듭니다.

Swap 영역은 윈도우의 가상 메모리 부분이라고 보시면 됩니다.

대략적으로 모르시는 분들은 기존 PC의 RAM 정도 혹은 배수로 설정해주세요. (ex: 4GB RAM 이면 4096 MB)

  1. / 영역을 생성합니다.

아래 그림과 같이 설정하는데,

크기에 유의해서 설정합니다.

  1. /home 영역을 생성합니다.
  1. 아래와 같이 영역이 생성됨을 확인 할 수 있습니다.

swap / /home

각각 생성됨을 확인하고, 지금 설치(I)를 클릭

이제부터 별탈 없이 계속 클릭하시면 됩니다.

  1. 계속 클릭
  1. 살고 계신 지역인 한국의 수도로 선택
  1. 한국어에서 한국어(101/104 호환) 선택
  1. 계정 생성
  1. 설치가 진행됩니다.
  1. 설치가 완료되면 '지금 다시시작'을 눌러주시면 됩니다.

USB는 빼주세요.

아래처럼 재시작 되면

Try 뭐시기였던게 Ubuntu로 바뀌어 있습니다.

Ubuntu 엔터 !

다음 화면처럼 초기 로그인 창이 뜨면서 Ubuntu가 구동됩니다.

여기까지가 윈도우 10에서 우분투 듀얼부팅하기입니다.

맨 처음 우분투를 설치했을 때가 넷북을 쓰던 시절이었습니다.

그땐 별로 어렵지 않게 했던 것 같은데,

패스트 부팅이다 시큐어 부팅이다 뭐다 해서

좀 번거로웠지만, 잘 따라하시면 큰 문제 없을 것 같습니다.

3) Virtualbox에서 실제 하드디스크에 설치된 Ubuntu에 들어가기

  1. Creating the VirtualBox Hard Drive

Now you can run the command to create the virtual hard drive file that points to your desired physical drive. For each of the following examples ensure that you input the desired names between the arrows and replace the number or pound sign with your desired drive number.

For Windows: 우분투 설치 파티션 확인 cd C:\Program Files\Oracle\VirtualBox> VBoxManage.exe internalcommands listpartitions -rawdisk \.\PhysicalDrive0

디스크 vmdk 파일 생성 VBoxManage internalcommands createrawvmdk -filename "C:\Users\\VirtualBox VMs\\.vmdk" -rawdisk \.\PhysicalDrive# -partitions #,#,#

For Linux:

VBoxManage internalcommands createrawvmdk -filename "</path/to/file>.vmdk" -rawdisk /dev/sda

For Mac OS X:

VBoxManage internalcommands createrawvmdk -filename "</path/to/file>.vmdk" -rawdisk /dev/disk#

  1. VirtualBox 실행
  2. 새로 만들기로 Ubuntu 추가
  3. EFI 부트 체크 ("FATAL: INT18 BOOT FAILURE" 오류시)
  4. "관리자 권한"으로 VirtualBox 실행

When creating the vmdk file, the -mbr parameter is not necessary, but be sure NOT to include the partition in which the host OS resides, that is, including whole physical drive in vmdk will fail. My final command line (with host partition #3 excluded) was: C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk -filename e:\VirtualBox\Ubuntu.vmdk -rawdisk \.\PhysicalDrive0 -partitions 1,2,4,5,6,7 After creating the guest machine (as described in the question), go to guest Settings, System, MotherBoard, Extended Features, be sure to keep "Enable EFI (special OSes only)" checked. Start the guest, and quickly press Del to enter the guest's VirtualBox BIOS before it shows the Windows boot menu. If you failed to do so and got to the Windows boot menu, forcibly turn the power off to the guest and start again. In BIOS, go to Boot Maintenance Manager, Boot Options, Change Boot Order. Move EFI Internal Shell to the first option, Commit Changes and Exit. Press Reset System menu item in Boot Maintenance Manager screen. There are instructions on how to change the boot order at the bottom of the BIOS screen. When the guest reboots again, it will enter EFI shell (instead of Windows boot menu). Now you need to work out which partition is the EFI bootloader. Upon entering the shell it prints out the partiions and their alises, but it didn't seem to print them all out for me. Once you've worked out which is your EFI bootloader, run:

BLK2:\EFI\ubuntu\grubx64.efi It will return an error if it's not the EFI bootloader. Now the GRUB boot menu displays and we can launch Ubuntu.

<다른 솔루션> Step One: Create Your New Virtual Machine

Assuming you already have both partitions set up, boot into Windows and perform the following steps:

  1. Back up everything before you begin. No, I'm serious. Don't skip this step. Don't!
  2. Open up a Command Prompt as an administrator and run the following command: wmic diskdrive list brief /format:list Find the drive on which your Linux partition resides and note its number (in my case, it was Disk 0)
  3. Use the CD command to change to the directory in which VirtualBox is installed. For me, this was: CD "C:\Program Files\Oracle\VirtualBox"
  4. Run this next command, replcaing the variables with the correct ones for your system: VBoxManage internalcommands createrawvmdk -filename "C:\Users\Whitson\Desktop\Ubuntu.vmdk" -rawdisk \.\PhysicalDrive0 Replace the file path with wherever you want to put your VMDK file. Replace the 0 in \.\PhysicalDrive0 with your disk number.
  5. You should get a message saying the VMDK was created successfully. If not, make sure you followed these steps exactly, and if you're still having problems read through that manual chapter. You may have special needs that we didn't discuss here.

Step Two: Create a GRUB ISO

Now, boot into Linux. We're going to use Ubuntu for this example. Before we set up our virtual machine, we'll need to put the GRUB bootloader on an ISO, since not all computers will load your existing version of GRUB properly. Once you're inside Linux, perform the following steps:

  1. Create a new folder on your desktop and call it "iso." Inside that folder, create one called "boot," and inside the boot folder, create a folder called "grub."
  2. Open a terminal and run the following command: cp /usr/lib/grub/x86_64-efi/* /home//Desktop/iso/boot/grub Obviously, replace "yourusername" with your user name.
  3. Next, run: cp /boot/grub/grub.cfg /home/yourusername/Desktop/iso/boot/grub
  4. Run the following command: sudo nano /home//Desktop/iso/boot/grub/grub.cfg Scroll down to the section that says "menuentry 'Windows'" or something similar, and delete everything from "menuentry" to the "}" at the end of that section.
  5. Lastly, run: grub-mkrescue -o boot.iso /home//Desktop/iso/ If you get an error saying "xorriso: not found," you may have to install the xorriso package with: sudo apt-get install xorriso When you're done, you should have a file called boot.iso in your home directory. Copy this to a flash drive or to your Windows partition.

Step Three: Boot Into Your New Virtual Machine

Now, it's time to boot back into Windows and get this sucker up and running. Once you've returned to Windows:

  1. Run VirtualBox as an administrator. Click the New button and name your virtual machine. Choose the amount of RAM to allocate to the virtual machine as normal.
  2. At the next step, choose "Use an existing virtual hard drive file." Click the browse button on the right, and browse to the VMDK file we made earlier. Click the Create button. If all goes well, you should see it show up in VirtualBox's sidebar.
  3. Select your new virtual machine in the sidebar and click the Settings button. Under Storage, select "Controller: IDE" and click the plus sign next to it. Press "Choose Disk" and navigate to the boot.iso file we created earlier. Click OK and return to the main VirtualBox screen.
  4. Select your new virtual machine and click the Start button. Choose Linux from the GRUB menu that pops up.
  5. If all goes well, you should see your Linux installation's login screen. You can log in, install VirtualBox's Guest Additions, and use your Linux partition without shutting down Windows!

IMPORTANT NOTE: Never try to mount or read from your Windows partition while you're running Linux in VirtualBox. This is where the danger of this method comes in. If you try to read your Windows partition, your machine will crash and you could cause data corruption (since your host OS is already using that partition). In fact, I recommend removing it from your fstab file so it never pops up in Linux, thus keeping you much safer.

<<< NOT PROPER >> i386 Folder problem** 2nd option : install Boot-Repair in Ubuntu

  • either from an Ubuntu live-session (boot your computer on a Ubuntu live-CD or live-USB then choose "Try Ubuntu") or from your installed Ubuntu session (if you can access it)

  • connect to the Internet

  • open a new Terminal, then type the following commands (press Enter after each line):

sudo add-apt-repository ppa:yannubuntu/boot-repair sudo apt-get update sudo apt-get install -y boot-repair && boot-repair

Using Boot-Repair

Recommended repair

launch Boot-Repair from either :
    the Dash (the Ubuntu logo at the top-left of the screen)
    or by typing 'boot-repair' in a terminal 

Then click the "Recommended repair" button. When repair is finished, note the URL (paste.ubuntu.com/XXXXX) that appeared on a paper, then reboot and check if you recovered access to your OSs.
If the repair did not succeed, indicate the URL to people who help you by email or forum. 

  1. Guest Extension Pack Install
  2. sudo usermod -a -G vboxsf
  3. Logout & Login
  4. sudo ln -s /media/sf_ /home/json/

2. 개발툴 설치 하기

1) Cuda Toolkit 설치하기

  1. 설치 파일 다운로드
    https://developer.nvidia.com/cuda-toolkit
    자신의 운영체제에 맞춰 다운로드 하면 되는데 반드시 run 파일로 다운로드 한다. CUDA를 설치하면 자연스레 Nvidia 드라이버도 설치되니 따로 설치하지 않아도 된다. 그렇게 설치해야 나중에 호환 문제로 고생하지 않는다.

  2. 설치된 이전 버전을 지운다
    sudo apt-get remove nvidia* && sudo apt-get autoremove

  3. 우분투 기본 그래픽 드라이버 끄기

우분투에는 nouveau 라는 기본 그래픽 드라이버가 있다. 이게 꺼져야 nvidia 드라이버가 작동을 한다. nvidia 드라이버를 설치하기 전에 nouveau를 비활성화시켜야 한다.

sudo gedit /etc/modprobe.d/blacklist-nouveau.conf

하고 아래 코드 추가

blacklist nouveau options nouveau modeset=0

그리고 터미널에서 sudo update-initramfs -u

한 후 Reboot!

  1. 디스플레이 매니저 종료

sudo service lightdm stop

그럼 그냥 까만 화면만 나온다. 당황하지 말고 Ctrl+Alt+F1을 누르면 로그인하고 명령을 입력할 수 있게 된다.

  1. CUDA 설치

다운로드가 완료됐다면

cd Downloads

이름은 탭으로 자동 완성 하자;;
chmod a+x cuda~.run
sudo ./cuda~.run

하면 라이센스 관련 글들이 나온다. 100%까지 스페이스를 쭈~욱 눌러서 지나가주자.

그리고 질문을 몇 개 하는데 다음과 같이 답한다.

Do you accept the previously read EULA? (accept/decline/quit): accept Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 367.48? ((y)es/(n)o/(q)uit): y

Open GL은 설치하지 않는다!

Do you want to install the OpenGL libraries? ((y)es/(n)o/(q)uit) [ default is yes ]: n Do you want to run nvidia-xconfig? ((y)es/(n)o/(q)uit) [ default is yes ]:n Install the CUDA 8.0 Toolkit? ((y)es/(n)o/(q)uit): y Enter Toolkit Location [ default is /usr/local/cuda-8.0 ]: [Enter] Do you want to install a symbolic link at /usr/local/cuda? ((y)es/(n)o/(q)uit): y Install the CUDA 8.0 Samples? ((y)es/(n)o/(q)uit): y Enter CUDA Samples Location [ default is /home/(user_name) ]: [Enter]

설치가 완료되면 다시 디스플레이 매니져를 켜서 화면을 복구한다.

sudo service lightdm start

되긴 되는데 뭔가 찝찝하니 Reboot 해주자.

설치 됐는지 확인하려면 간단한 버전과 상태 확인 명령어를 쳐보자.

nvcc -V

nvidia-smi

이렇게 하면 nvcc는 설치되지 않았다고 뜰 것이다. 그런데 /usr/bin/local/cuda-8.0/bin 에는 분명히 nvcc가 있다.

그럼 결론은 다음과 같이 PATH를 설정해줘야 한다는 것이다.

sudo gedit ~/.profile

아래 두 줄 추가

export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

저장하고 닫고 이걸 활성화 시키자. source ~/.profile

다시 nvcc -V 라고 쳐보자. 이제는 설치된 CUDA 버전이 보일 것이다.

CUDA가 /usr/local/include와 /usr/local/lib 에 설치되지 않고 /usr/local 에 독자적인 경로에 설치되기 때문에 이렇게 경로를 설정해줘야 한다.

  1. Troubleshooting

이대로 잘 끝나주기만 하면 얼마나 좋겠는가?

내가 겪은 끔찍한 두 가지 에러에 대한 해결책을 알려주고 마무리 한다.

설치 과정에서 "the driver installation is unable to locate the kernel source..."

라고 헛소리를 해댄다면 커널 소스를 설치해주자.

sudo apt-get install dkms fakeroot build-essential linux-headers-generic

혹은 "You appear to be running an X server..." 라고 한다면 그냥 프로세스와 관련된 폴더를 지워버리자.

cd /tmp rm -rf .X0-lock

2) Cuda Toolkit 설치 후 Ubuntu Login 문제 해결

< Ubuntu > This problem was caused due to secure boot and EFI_SECURE_BOOT_SIG_ENFORCE in linux kernel 4.4.0-20 and later.

I installed the nvidia-364 drivers and entered the key when asked. Then i rebooted the system. when blue screen of mok management appeared i pressed any key to changed it. Then it asked for password characters. then it let me to disable it. i reinstalled the nvidia 364 after booting in insecure mode. and it worked like charm.

You may not need to do all the steps. Some people are saying you only need to disable the validation by running

sudo apt install mokutil sudo mokutil --disable-validation

1- First, you must uninstall nvidia packages. apt-get purge nvidia-*

  • 아래 Uninstall 참조 2- Try re-install sudo apt-get install ubuntu-desktop. 3- Reconfigure lightdm package. (dpkg-reconfigure lightdm) 4- Reboot

< Virtualbox >

  1. VboxGuestAddition 재설치

2) Cuda Toolkin Uninstall 하기

  1. Uninstall just nvidia-cuda-toolkit

sudo apt-get remove nvidia-cuda-toolkit

  1. Uninstall nvidia-cuda-toolkit and it's dependencies

sudo apt-get remove --auto-remove nvidia-cuda-toolkit

  1. Purging config/data

sudo apt-get purge nvidia-cuda-toolkit or sudo apt-get purge --auto-remove nvidia-cuda-toolkit

  1. Additionally,
  2. Delete the /opt/cuda and ~/NVIDIA_GPU_Computing_SDK folders if they are present.
  3. and remove the export PATH=$PATH:/opt/cuda/bin and export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib:/opt/cuda/lib64 lines of the ~/.profile file

2) Qt 설치 하기

Qt 간단하게 설치하는 법!

sudo apt-get install build-essential libgl1-mesa-dev sudo apt-get install qt5-default sudo apt-get install qtcreator

2. 디스크와 파일 관리 하기

1. efFat 디스크 사용하기

Installing the below packages alone will auto-mounts your exFAT formatted drives ,

sudo apt-get install exfat-fuse exfat-utils

Or you may try to mount it manually after installing the above packages,

sudo mkdir /media/exfat sudo mount -t exfat /dev/sdxx /media/exfat

/dev/sdxx - your exfat partition.

In Ubuntu 14.04, exfat-fuse and exfat-utils packages are available in Universe repository. So enable this repository inorder to install these two packages on Ubuntu 14.04.

sudo add-apt-repository universe

And don't forget to update all repositories,

sudo apt-get update

xRDP

  1. sudo apt-get install xrdp

    (여기까지만 수행하고 원격 접속해 보면 회색 화면만 보게 된다.)

  2. sudo apt-get install xfce4

  3. sudo gedit /etc/xrdp/startwm.sh

. /etc/X11/Xsession를 삭제 또는 주석 처리(맨앞에 #추가)하고 아래와 같이 수정한다.

!/bin/sh

if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG LANGUAGE fi

. /etc/X11/Xsession

. /usr/bin/startxfce4

  1. sudo /etc/init.d/xrdp restart

VNC Server

1) sudo apt-get update 2) sudo apt-get install xfce4 xfce4-goodies tightvncserver

  1. 필요 패키지 설치
본래는 아래 패키지들도 설치해야하지만, 이미 설치되어 있어서 제외하고 설치해도 된다.



    - sudo apt-get install gnome-settings-daemon gnome-terminal metacity nautilus



아래와 같이 필요한 패키지를 설치하자

$ sudo apt-get install gnome-panel tightvncserver

  1. 첫 실행
첫 실행을 해서 기본 Config 등의 구성을 하도록 하면 되는데,

sudo 없이 계정 권한으로 실행하여도 된다.

$ vncserver

아래와 같이 패스워드 설정을 진행하면 된다.







위의 화면을 보면 알겠지만, 계정 권한으로 실행을 하면 해당 계정으로 환경 설정을 한다.
  1. 기본 창 관리자 변경
기본 생성된 xstartup 파일에는 내가 원하는 대로 환경 설정이 되어 있지 않다.

가장 먼저 실행된 vnc4server를 종료부터 하고 xstartup 파일을 수정하자.

$ vncserver -kill :1

$ cp ~/.vnc/xstartup ~/.vnc/xstartup.old

$ nano ~/.vnc/xstartup

!/bin/sh

export XKL_XMODMAP_DISABLE=1 unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic &

gnome-panel & gnome-settings-daemon & metacity & nautilus & gnome-terminal &

  1. 다시 실행하기
실행할 때에 해상도를 미리 정해줘야 한다.

$ vncserver -geometry 1024x768

  1. VNC Viewer 로 접속하기
다른 PC에서 해당 IP로 접속하면 된다. 물론 뒤에 디스플레이 번호 붙여서...

VNC Viewer를 그대로 사용할 수도 있다.





예쁘게 잘 나온다!
  1. TightVNC Java Viewer 로 접속하기
이왕 TightVNC를 사용하는 김에 Viewer도 바꿔 보자.



   - http://www.tightvnc.com/download.php





다운로드 후 압축을 풀어서 실행하면 된다.







실행하는 방법은 살짝 다르다. 여기에서는 Display가 아니라 포트 번호를 적어주면 된다.







실행은 뭐 당연하게도 잘된다!
  1. 부팅 時 자동으로 실행
이제 잘 되는 것 까지는 확인했으니, 부팅할 때에 알아서 되도록만 하면 되겠다.

$ sudo nano /etc/init.d/vncserver

아래 내용을 그대로 사용하면 된다.

USER 부분이나 해상도 부분은 각자 상황에 맞게...

!/bin/bash

BEGIN INIT INFO

Provides: vncserver

Required-Start: networking

Required-Stop: networking

Default-Start: 2 3 4 5

Default-Stop: 0 1 6

END INIT INFO

PATH="$PATH:/usr/bin/" export USER="u12"

DISPLAY="1" DEPTH="16" GEOMETRY="1024x768"

OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"

. /lib/lsb/init-functions

case "$1" in start) log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver ${OPTIONS}" ;;

stop) log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}" ;;

restart) $0 stop $0 start ;; esac exit 0

$ sudo chmod +x /etc/init.d/vncserver

$ sudo update-rc.d vncserver defaults

이제는 재부팅을 하여도 잘 된다~!!!

results matching ""

    No results matching ""