ubantu mysql.sock_ubuntu mysql.sock问题解决

This past weekend, I finally took the plunge and installed

Ubuntu Linux on my PC.

Installation couldn’t have been simpler — you honestly don’t need

to have a tech background to get this up and running; just download

and burn a disc image, boot from the CD, and Ubuntu does the rest.

It recognized all of my hardware automatically, which is more than

Windows can claim (everytime I do a fresh install of XP, I forget

that it doesn’t know about my network card, so I have to open the

case, figure out the card make/model, download the drivers to a

friend’s computer and then transfer them over to mine).

Configuring Ubuntu

Through a ton of trial and error and double-digit fresh

installs, I’ve developed a procedure for getting Ubuntu configured

in six easy steps. Obviously, this is tailored to my specific

needs, but I’m not doing anything too wild here.

1. Open up /etc/apt/sources.list and uncomment the two

lines that look like this:

deb http://us.archive.ubuntu.com/ubuntu/ dapper universe

deb-src http://us.archive.ubuntu.com/ubuntu/ dapper universe

APT is

Ubuntu’s package management utility, and by uncommenting those two

lines, you give it access to software not supported by the Ubuntu

team. It’s where the fun stuff lives, though :)

2. To alert APT to all the new

packages you’ve just given it access to, run the following:

sudo apt-get update

3. Now the big kahuna …

sudo apt-get install ssh mysql-server apache2 php5

libapache2-mod-auth-mysql php5-mysql phpmyadmin netatalk ruby irb

rails synergy

Here’s where APT shows its strength.

By executing this one command, it installs, configures and deploys

(deep breath) SSH,

the Apache webserver,

MySQL, PHP (with phpMyAdmin), Ruby on Rails, and two

lesser-known, but still very cool pieces of software: Netatalk and Synergy.

Netatalk allows you to use Apple’s “connect to server” feature

so that you can use the Linux box as a drive on a Mac. Synergy lets

you use one mouse/keyboard to control multiple computers,

regardless of OS. I can drag the mouse to the right side of my

laptop screen, and it goes over to the Linux box.

4. These last three steps are pretty technology-specific. In

order to get PHP and MySQL working

together, open /etc/php5/apache2/php.ini and uncomment

this line:

extension=mysql.iso

This will give PHP access to the MySQL

libraries, and PHP without MySQL is like

a party without beer … you could, but what’s the point?

5. After changing the php.ini file in step #4, Apache will need

to be restarted:

sudo apache2ctl restart

6. This last step is just for Ruby on Rails. For whatever

reason, Ubuntu puts the mysql.sock file in a different

place than most Linux distros, confusing Rails. In order to point

it to the correct place, create the following symlink:

ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

And that’s it. Pretty straightforward, huh?

Some good resources

There’s a ton of information about Ubuntu on the web. Here are a

few sites that really stood out for me:

I know I’ve glossed over a lot of details here, so if you have

any questions or thoughts, please do let me know through comments

or the contact

form.

Comments

I want to try Ubuntu – I found your site after doing a google

search. So far, so good, but why oh why do you use a dark brown

background and in some places – like two lines under “THE BIG

KAHUNA” which are completely unreadable – it looks like brown text

on a brown background !! And Item 6 something called a symlink – I

can’t read it. How can I change the colours to something more

readable ?

— Geoff · Oct 23, 01:56 PM · #

Geoff: thanks for your feedback—didn’t know anyone was actually

reading this :) Changed the colors a bit to hopefully make things

more readable.

— David · Oct 23, 02:12 PM · #

Very helpful, thanks! Had Netatalk up and running in just a few

minutes.

— Roger · Feb 28, 02:21 PM · #

David. Your blog is awesome.

— Gary S. Weaver · Jan 25, 08:07 AM · #

Hello,

The title of the article sort of makes it sound like it this is

something that all new users might want to do, but in fact it is

not really applicable to a lot of people starting with Ubuntu these

days. A lot of them are just people fed up with Windows

& Microsoft, or are curious about Ubuntu/Linux.

They are just using their computers for general purpose stuff. They

don’t need things like: SSH, the Apache

webserver, MySQL, PHP (with phpMyAdmin),

Ruby on Rails, Netatalk and Synergy. Your average Joe is not going

to be playing around with phpMyAdmin.

What you’ve described is something more like “How to configure

Ubuntu for web-programming guys like myself.” it’s great that

you’ve distilled it down to exactly what you need to install those

items, but maybe it would be good if you pointed that out in the

title, or somewhere near the top that these items are not

necessarily for regular people who just want to send email and

access the web.

And as far as enabling Universe, that is a good idea, but I

would not necessarily start by telling people to go to the command

line and edit files. New users are often put off by the command

line as they are not used to it (they didn’t grow up in the

DOS days, or they completely bypassed the

DOS days, and they never used the unix in

the pre-web days) it seems like something for geeks and admins.

These days there is an easier way to enable the Universe

repository:

System -> Administration ->

Software Sources, Ubuntu software tab and check the “Universe” and

“Multiverse” tabs.

(Also, “Big Kahuna”? What on earth is a Kahuna? Sounds like a

Hawaiian reference. )

— Peter Piper · Jun 23, 02:47 AM · #

guys, i myself was thinking that this one is for beginners

trying to explore with ubuntu. however, looks like a simple

procedure for computer guru. it might be appropriate if you could

include some simple mouse clicks from installation to navigation

inside ubuntu.

anyway, this site looks cool.

— junnel · Jun 30, 11:48 AM · #

Oh come on you two! the guy has at least put in effort to tell

people how to get their machines set up for a few things. May or

may not be applicable to your ‘average joe’, but the author clearly

mentioned that these settings were for him and may not be

applicable to some users. Good work and keep it up!

— Syed · Sep 4, 04:16 PM · #

This was very useful and saved me time and effort. Much

appreciated.

— no · Sep 21,

10:03 PM · #

Thank you for your helpful pages.

Regarding page colours (you can see I’m not from USA) and styles, I often use the Firefox

>view > page style >

No Style option to read some pages. I like your attractive page

styles very much, but being old in the eyes means they aren’t so

clear to me as “No Style”, but hey – whatever works, right?

May I suggest you include ‘year’ in your date of submission for

readers’ comments – especially useful when they span several years,

perhaps?

— Peter L Collins · Dec 1, 03:48 PM · #

Well, it’s May 1, 2009 and I’m a new Ubuntu user with a fresh

install of 9.04. Are all of these steps still relevant or have some

become obsolete in newer releases? Please, update your very useful

content. Also, are there any other add-ons you would recommend that

have become available since you wrote this? I want to create a

fully optimized starting point, then create an image so I can

totally screw things up and then start over without needing to go

through all of the obligatory steps. (like enabling Ubuntu to play

encrypted DVDs, etc.)

Thanks

— Duncan · May 1, 12:38 AM · #

I agree, although it is nice to see that there is more you can

do with the dapper universe, I do recommend we stick to basics and

evolve based on the title.. comments?

— Greg · May 20, 11:09 PM · #

Duncan – Three years later, this is still how I setup a fresh

Ubuntu install. The only thing I do differently is install rails

using gem rather than apt-get.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值