Setting up Ubuntu working environment on MacBook

Source: Internet
Author: User
Tags hosting macbook

Working environment needs: ubuntu12.04, gcc 4.4.7, vim, source insight, git.

1. Making a Startup disk

The first thing you need to do is create an Ubuntu startup disk that starts from an Apple computer:

In the terminal of the Apple Computer, enter:

Hdiutil Convert/path/ubuntu.iso-format Udrw-o/PATH/UBUNTU.DMG

This command converts an ISO-formatted image file into a DMG format on the MacBook Air.

Insert a blank USB flash drive and run the following command to view its ordinal number

Diskutil List

Run the following command to change N to the serial number of your USB flash drive, usually 2 or 1.

Diskutil UNMOUNTDISK/DEV/DISKN

Run the following command to change N to the serial number of your USB flash drive.

sudo dd if=/path/to/ubuntu.dmg of=/dev/rdiskn bs=1m

Exit the U disk and change N to the serial number of your U disk

Diskutil EJECT/DEV/DISKN

2. Install the system under mac

After you have prepared your USB flash drive, you also need to carve a partition on your hard drive to use for Ubuntu, using the disk tool that comes with your Mac system, or Bootcamp. Insert the USB drive to restart your Mac, and hold down the option key until the disk selection appears. Select the EFI boot entry and enter the Ubuntu trial mode after choosing try Ubuntu. It will be installed as usual thereafter.

In fact, the root directory 10G is possible

After the partition is set up, there is also a "device to install boot boot",macbookpro user needs to select the disk location (set this Ubuntu , the direct deletion will not affect the start of Mac system).

After the installation is complete, be careful not to restart this button, choose to continue to try Ubuntu, we have to solve the boot boot problem, or restart is unable to enter Ubuntu. Next, execute the following command to fix the boot.

sudo apt-get install Efibootmgr

sudo efibootmgr

sudo efibootmgr-o 0,80

You can restart it later. You can enter Ubuntu after a reboot, but you'll need to continue with the repair or you won't get into Mac OS x.

sudo gedit/etc/grub.d/40_custom

Add the following lines at the end of the displayed text.

Menuentry "Mac OS X"

{

Exit

}

(If you reinstall the MAC system, you can not go to Ubuntu system, use the Ubuntu installation, try the Ubuntu system, and then set up a efibootmgr will be able to new boot)

If using Ubuntu Grub boot does not enter the Mac, then power on and hold down the option key to select Mac Boot, and then install refit boot under Mac, installed in the Mac terminal to enter:

cd/efi/refit/

./enable-always.sh start Refit.

Restart and you'll see the Ubuntu options.

3. Install vim

Sudo Apt-get Install Vim

4. reduce the gcc version

1. sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib

2. sudo update-alternatives--install/usr/bin/g++ g++/usr/bin/g++-4.4 100

3. sudo update-alternatives--install/usr/bin/g++ g++/usr/bin/g++-4.6 50

4. sudo update-alternatives--install/usr/bin/gcc gcc/usr/bin/gcc-4.4 100

5. Sudo update-alternatives--INSTALL/USR/BIN/GCC gcc/usr/bin/gcc-4.6 50

6. Sudo update-alternatives--install/usr/bin/cpp cpp-bin/usr/bin/cpp-4.4 100

7. Sudo update-alternatives--install/usr/bin/cpp cpp-bin/usr/bin/cpp-4.6 50

8.gcc–v

5. Install Source Insight under Ubuntu

First install wine, go to Ubuntu Software Center, search wine, install. After the installation has finished wine, download the source Insight software under Windows, right-click to open with wine, you can install like Windows.

6. install git

sudo apt-get install git

If you don't need to use GitHub managed code after installing Git, you don't need to configure a GitHub account, and if you need GitHub hosting, you'll need to continue setting up your GitHub account.

git config--global user.name "Your Real name"

git config--global user.email [email protected]

First use SSH command to connect github.com SSH service, login username is git (all GitHub users share this SSH user name)

ssh–t [email protected]

If prompted: Permission denied (PublicKey).

Note that we have not yet set up public key authentication in the GitHub account.

Create a public key by Ssh-keygen-c "GitHub registered account"-F ~/.ssh/github: always enter

Next, copy the contents of the ~/.ssh/github.pub file to the Clipboard and copy it to the key window

After clicking Add key, you can see that the public key has been generated.

Go to Ubuntu terminal again, enter ssh–t [email protected]

Indicates that the connection has been successfully made so that you can access the GitHub hosting server directly from the git command.

7. download the code from the server:

mkdir GitHub

CD GitHub

git clone [email protected]: "username"/"warehouse name". Git//no spaces in between

After acquiring the source code, you can develop it, and you can commit the code as soon as it is completed:

git Add. Add and modify files to the staging area without processing deleted files

git status//compare local Data directory and staging area changes

git commit-m "commit directions"//Submit code to the local data directory and add the commit instructions

If the submitted version and other people's changes are the same, then the conflict is unavoidable, then after the submission can be obtained after the code, will prompt the code conflict files, we need to do is to deal with these conflicts, and resubmit:

Git pull//update code, follow the prompts to modify the code in the conflicting file

git Add.

git commit–m "Commit directions"

When you are done with the above steps, you need to do something to synchronize the data from the repository of the local data directory to the GitHub server so that your colleagues can see the changes you made:

git push//last step

8. How Github uses the organization to share code:

Create an organization and build a warehouse under the organization. As long as everyone who joins the organization has permission to submit code,

git clone [email protected]: "Organization name"/"warehouse name". Git (the whole sentence has no spaces)

Then the other action is the same as the previous operation.

It's best to git pull a bit before updating the code, and the other people on the prevention team have changed the code.

Setting up Ubuntu working environment on MacBook

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.