Running a Webserver on a Tonido Plug PDF Print E-mail
Written by Administrator   
Tuesday, 16 November 2010 20:16
Article Index
Running a Webserver on a Tonido Plug
Getting Started
Installing PlugBox Linux
Installing the Apache Webserver
Installing an FTP server on a Tonido Plug
Apache and Bftp Autostart at Boot
Getting a JDK to run on a Tonido Plug
Compiling Tomcat from source on Plugbox Linux
Getting Tomcat Running After Building It
All Pages

Setting Up A $99 Plug Computer To Run Apache and Tomcat

Tondio Plug

 

  If you ever wanted to have your very own webserver running 24/7, you can now do it for a total investment of $99.   This little champ will use only a few watts of power, and has no noisy fan. 

   The software is all open source, and freely available on the web.   Getting a web server running is fairly easy.    If all you want to do is host a website, then installing Apache would be enough.

 The following is not exactly a how-to or a tutorial, since that implies I know what I'm doing.   Instead it is kind of a narrative about what I did to get it to work.

The General Description

   In my case, I wanted to run Tomcat, which would allow the server to generate active content.  I.E. instead of just fetching HTML pages and images, it will run my Java programs and create web pages as the user interact with my site.

  In particular, I wanted to make a Google Web Toolkit application.   GWT is a way to make programs which run in the user's web browser, but also can communicate easily with a webserver.  

   So I picture this as something that I fiddle with until I am happy with it, and then it can just sit there and run forever and never cause me any problems.  Anyway, that is the fantasy...

   To install Apache and Tomcat running on PlugBox Linux, it will be necessary to to have a Tonido Plug, and a USB Flash Drive which you don't mind completely erasing.   I used a Patriot 8Gb XPorter.

 


 Getting Started

  My plug arrived in a cute box with a magnetic lid.    It is interesting to use a computer that not only has no screen, but doesn't even have anywhere to plug one in.    It is like the good old days when the only way to communicate with a computer was with a terminal.   I still have my Hazeltine 1500 in the basement, although I doubt the poor thing still works.

   To communicate with the plug will require it to be connected to your local network with an ethernet cable.   Tonido politely provides one for you.   Just plug it into your DSL or Cable router or a hub on your network.    The device will get an IP address from your router using DHCP.  This is important to know, because before we can actually talk to it, we'll need to know what that IP address is.

   The Tonido also has a solitary USB port.   You can insert a USB flash key to this port.   Tonido's product is software which allows all your computers to access what is on that flash key, either computers at home, or anywhere on the internet.

 

  As delivered the computer comes with 512 megabytes of flash and 512 megabytes of RAM.   The flash contains a Linux filesystem with Ubuntu 9.04 installed on it.  If what you really wanted it for is to have a computer on all the time with all your music and videos on it, there probably be no reason to change anything.   The device showed up on my Windows network and behaved well with no setup.  If all you want is Apache, php and Python, then be aware that Tonido sells a ready-to-go filesystem image with one already built for you for $49.  They call it the TonidoPlug Custom Image - W/Lamp.  You can get it by going to the 'Buy Now' button on their plug page.

 

  The first step to doing anything with the Tonido is to find out its IP address on your network.   In my case this was pretty easy.  I just went to the web page of my wireless router and viewed the attached devices.   The Tonido was there in the list.   Since I always wanted the router to give the Tonido the same IP address, I went to the screen where you could reserve IP addresses for certain devices.   Thus from now on, my Tonido should always get that same IP address.

 

  Now once you have the IP address, you can see if it is really working.

 

  We will use another computer to open a console session on the Tonido.   For that we want an SSH client program.  There is an excellent free program called Putty available.

 

  Putty is just an exe.  It doesn't need to be installed.   Just download it and place it somewhere on your hard drive.    You can make a shortcut to the .EXE for your desktop, or just double click on it in Windows File Explorer.

 

  Run putty and type the IP address of your Tonido and press the 'open' button.   Make sure the SSH radio button is selected, and the Port number is 22.   If it connects you will get a warning box from Putty.   Accept the certificate and continue.  If you see 

 

  login as:

 

  in your Putty window, then your Tonido is working and you got the IP address correct.   The text in blue indicates the part you type in.

 

 login as: root

pw:  nosoup4u

 
  If all is working, you should now be in Linux Bash command shell, running Ubuntu 9.04.
 
  When the Tonido boots with no USB Flash driver connected, it will boot Ubuntu from the 512Megabyte internal flash memory.   However, if one has a USB Flash Drive plugged in which has a bootable Linux filesystem on it,  the Tonido will boot from that instead.   The plan here is to format your USB Flash Drive to be Linux filesystem, and we will install Plugbox Linux on it.   
 
 
   In the next page we will reformat your flash drive and install PlugBox Linux on it.
 

Installing PlugBox Linux on your Tonido Plug

   On the previous page we covered how to connect to your Tonido plug using SSH with the Putty program running on your PC.   Once you are logged as root, then you can connect your USB Flash drive.   Ubuntu will automatically see the drive and mount it to /media/disk1part1.    What we are going to do is unmount it and reformat it with a Linux Filesystem.  Then we will download an OS image  from plugapps.com and unpack it onto the newly formated drive.   
 
  The steps I did to accomplish this are on the PlugApps: Getting Started: Tonido web page
 
 
After the Tonido plug has booted with no flash drive inserted, log in as root using Putty on your PC. Then plug in the flash drive that you want to install Plugbox Linux on.
 
 
(The following steps were taken from the PlugApps Tonido Tutorial
 
cd /
/etc/init.d/samba stop
umount /media/disk1part1
mkfs.ext2 /dev/sda1
mount /dev/sda1 /media/disk1part1
cd /media/disk1part1
wget
http://plugapps.com/os/1.1/Plugbox-Linux-1.1-rootfs.tar.gz
tar xzvf Plugbox-Linux-1.1-rootfs.tar.gz # This will take a long time
rm Plugbox-Linux-1.1-rootfs.tar.gz
initctl emit tstop
cp -dprv /root/app/tonido /media/disk1part1/usr/local/
cp -dprv /lib/libssl* /media/disk1part1/usr/local/tonido/
cp -dprv /lib/libcrypt* /media/disk1part1/usr/local/tonido/
cp -dprv /usr/lib/libjpeg* /media/disk1part1/usr/lib/
cp -dprv /usr/lib/libpng* /media/disk1part1/usr/lib/
cd /
umount /media/disk1part1
reboot
 
 Actually, the part which took the longest time for me was the umount command.   I think that the Patriot Drive actually has a large RAM cache on it.   So after the data was all written to the USB Flash drive from Ubuntu's point of view, the flash drive was still writing cached data to the permanent storage internally.   So if you have a flash drive which seems to be taking forever to unmount, don't assume it crashed or hung if the unmount seems to take a long time.
 
 Instead of typing in all these commands, I actually created a script.   I just typed
 
vi kevin_plugbox.sh
 
 Then I pressed ‘i’ to go into insert mode.  Then I copied the above commands into the windows clipboard on the PC, then I right-clicked in my putty window.   That dumped the commands into the file.  Then escape and shift-zz to save and exit.  Then I did a chmod +x kevin_plugbox.sh to make it so I could run my script.
Most people don't the VI editor, but the Ubuntu also has nano
 
   After you type that last command 'reboot', the Tonido plug should reboot.   Your Putty connection will be terminated, so after it reboots you will have to connect again.   However, when you return,  the Tonido plug will hopefully be running PlugBox linux instead of Ubuntu.   
 
   The first sign that it successfully booted the new image will be that Putty gets all worked up about the SSH credentials.    You will get a warning box that this device seems to be a different machine than last time.   You can clear Putty's stored certificate information to avoid this warning by running Putty with the command line option -cleanup
 
  The second sign that it worked is that the root password has now changed.   Instead of 'nosoup4u', the password will now be 'root'.
 
 Plugbox Linux Root Login
 
    Now that Plugbox Linux is running, the pacman package installer can be used to install all kinds of open source software which has been precompiled for the Arm processor.  On the next page we'll be updating and installing the Apache webserver.
 
 
 


Installing the Apache Webserver on your Plugbox Linux System

 

 Arch Linux uses pacman instead of apt for package management.   An excellent page for describing how to use pacman is here.

 
First, update your package sources
 
pacman -Sy
 
 
 
The first thing it will want you to do is update pacman itself.

[root@Plugbox ~]# pacman -S pacman

It will tell you that it wants to update pacman first, so you agree to cancel this update and install update pacman.   OK, whatever.   So you press capital Y.  You may need to press capital Y again.

Once that is finished we can actually install apache.

[root@Plugbox ~]# pacman -S apache

On my plug, the apache configuration text file was placed in the following path:

/etc/httpd/conf/httpd.conf

I looked through this, it seemed pretty well setup to run.   The default location for server content was set up to be:

/srv/http

The script to stop and start apache is in /usr/sbin:

/usr/sbin/apachectl

To start the server:

apachectl -k start

or

apachectl -k stop

If you start the server with the command above, apache should start running.  You can now use your pc to browse to the Tonido plug. Just type in the IP address of your plug into a web browser. Since there are no html files in your /srv/http folder yet, Apache shows a blank page like this.
 
 
Apache Running with no content 
 
 
 

   So Apache is running.   We'll look over the configuration a little later.   For now I wanted to get some HTML going.  I wanted at least one image in there too, so I wanted to bring some files in.   One way to get web content onto the device would be to install an FTP server.   Then I could access the content from anywhere.

   Next page we can get an FTP server running, create an HTML file, and transfer them to the flash drive.

 


Installing an FTP Server on a Tonido Plug

 I tried


pacman -Ss ftpd

to get a list of all the ftp server packages.  There were a bunch.   I chose bftpd because it was so small.   

pacman -S bftpd

It was quick to install.   Here is the page to the tutorial about how to set it up.

I used my vi insert from clipboard trick to copy the following script to bftpd.sh in my root home folder:

#!/bin/bash
 
 case "$1" in
   'start')
     echo "Starting bftpd Server"
     /usr/sbin/bftpd -d
     ;;
   'stop')
     echo "Stopping bftpd Server"
     killall bftpd
     ;;
   'restart')
     $0 stop
     sleep 1
     $0 start
     ;;
   *)
 echo "usage: $0 {start|stop|restart}"
 esac


I did

chmod +x bftpd.sh

so I could run it.

However,  I could not run ftp on my pc and log in as root because it didn’t let me.   So I need to create a user.   When you create a user you need to know what groups the user should belong to.   So I read about Arch Linux Groups, and User Management.

So I decided to make myself a user account.   I wanted to be in the following groups

users  - the standard users group
wheel - so I can use ‘sudo’ when I need to.
ftp - so I can write to the /srv/ftp folder
http - not sure what ramifications this has
power - so I can reboot
storage - so I can manage disks.

# useradd -g users -G group1,group2{,...} -m USERNAME

useradd -g users -G wheel,ftp,http,power,storage -m kevin

note:  I'm not sure this step worked, since I found later that I could not sudo, or power down from this account. 
 
This created a new user named ‘kevin’.   Then I set the password:

passwd kevin

It prompted me for a password.  I couldn’t think of a good one, so I just used my wife’s first name, which is usually a pretty secure choice....

Now I ran putty again on my PC and this time typed ‘kevin’ instead of ‘root’ and logged in as my very own self.

Very cool!  It worked.

Then I could try ftp.   Start ftp server with the script by typing the following in my root shh putty session:

bftpd.sh start

 This starts up the ftp server.   Then I could use FTP from any computer on my network.  I opened a command prompt on a Windows PC, and typed ‘ftp 192.168.1.19’

Then I could type in ‘kevin’ for my login name and my password I could transfer files to my plug.  The files by default go into my home directory for my kevin account.  I would rather the files go into the /srv/http folder.

So I used the vi editor to edit the file   /etc/bftpd.conf

Near line 130 I changed the ROOTDIR from

  ROOTDIR = “%h”

to

  ROOTDIR = “/srv”

I also skipped down near the end of the file to the user ftp section

I changed
 ANONYMOUS_USER=”yes”
to
 ANONYMOUS_USER=”no”

I don’t see any reason why I’d want anonymous ftp users on my system....

Then used my bftpd.sh script to start the FTP server up again.  Sure enough, I can now access the /srv folder.

But... I could not upload any files to the http folder.   I had to go back to the root ssh shell, and navigated to my /srv folder to change permissions so anybody can write to the file.   I allow write permission to users of the folder's group. Then I change the group of the http folder to the group named 'ftp'.

cd /srv
chmod 775 http
chgrp ftp http

Now I can write files to my http folder when logged in as kevin via ftp.   This allows members of the group to write to the http folder, and sets the group of the file to the ‘ftp’ group of which kevin is a member.

So then I uploaded a simple index.html file to the http folder using ftp.  I also created an images folder and uploaded an image that was referenced in my HTML.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
 <title>Kevin's Tonido Plug Server</title>
</head>

<body>
<h1>Kevin's Tonido Plug Server</h1>
<p>Welcome to the first page ever served by my Tonido Plug!</p>
<a href="http://www.tonidoplug.com/tonido_plug_why.html"><img src="/images/tonido_plug_hardware.png" width="294" height="357" border="0" alt="tonido plug"></a>
</body>
</html>

 

 First Real Page Served By Plugbox Linux on my Tonido Plug

 Tada!  This page was actually accessed from the outside world, since I had configured port forwarding on my router to open port 80 to point to my Tonido plug. This was really easy to do with my Netgear Rangemax wireless router. On the router's web page there is a port forwarding page where I just needed to specify which port I wanted to open, and which local IP address it should be forwarded to.

   On the next page I'll install Python and configure the system so Apache and the FTP server get started each time the system boots, instead of having to start them manually.

 


Installing Python and Getting Apache and BFTPD to AutoStart at Boot

 

 OK.  So now I have Tonido plug with apache, and FTP.   What is next?


Python!
 
So I used Putty to login as root to install more stuff.. 
 
 
pacman -Si python

It looks like they have python 3.1.2-2 which is cool because I wanted python 3.

so I installed it with

pacman -S python

After installation, I tried typing

python

Python 3.1.2 (r312:79147, Oct 19 2010, 15:46:23)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[kevin@Plugbox http]$

OK, it looks like that was really easy....


Making the webserver and ftp server start automatically every time we boot.

In my root ssh putty session, I changed directory over to my /etc/rc.d folder.  Then I could see a script there for httpd and one for bftpd.   The httpd one was fully of apache stuff, and obviously the bftpd one was for the ftp server.   So those are set to go.

I moved back out one directory level to /etc and edited /etc/rc.conf
 

 
rc.conf is the core system configuration file used in Arch Linux.
 
Near the end of the file, where it lists the daemons to start at boot up, I added httpd and bftpd to the end of the list, but inside the parentheses.   When I was finished it looked like this:

# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
# Daemons to start at boot-up (in this order)
#   - prefix a daemon with a ! to disable it
#   - prefix a daemon with a @ to start it up in the background
#
DAEMONS=(syslog-ng network netfs crond sshd httpd bftpd)

This part in blue is the new stuff we add to /etc/rc.conf

 

Try rebooting with the reboot command.   After restarting, hopefully the web server and the ftp server will be running.

 

on the next page I'll attempt to get a Java development environment installed, so I can get Tomcat going.

 


Getting a JDK to run on a Tonido Plug

 Doing


pacman -S openjdk6-debian

did not work.   :(

It made a bunch of links in my user/bin which pointed to a non-existent build folder.   I didn’t think the install worked correctly although I did not see any errors.   Is the package broken, or did something go wrong silently like it ran out of memory? Did I mess something up? I don't know, but it certainly did not work and I didn't see any way to proceeding from there.
 
Now I’m trying something else:

http://wiki.maemo.org/OpenJDK_6.0_0_(Cambridge_Software_Labs)_on_N900


mmm... This actually seemed to work.  I can compile and run Java programs...
 
I wrote to the owner of Cambridge Software Labs.   He asked me link to the files on my own site to save his bandwidth, so I did some of the steps in the link above and put the resulting file on this web site to make fewer steps.  
 
ok, here’s what I did:

I put the following shells in a file using the text editor and made it executable and ran it.

cd /opt
wget http://boldinventions.com/downloads/OpenJDK-camswl.tar.gz
tar zxf OpenJDK-camswl.tar.gz
/opt/OpenJDK-camswl/bin/java -version
chown -R kevin OpenJDK-camswl
cd /usr/bin
ln -s /opt/OpenJDK-camswl/bin/java /usr/bin
ln -s /opt/OpenJDK-camswl/bin/javac /usr/bin
ln -s /opt/OpenJDK-camswl/bin/jar /usr/bin
ln -s /opt/OpenJDK-camswl/bin/jdb /usr/bin
ln -s /opt/OpenJDK-camswl/bin/jarsigner /usr/bin
ln -s /opt/OpenJDK-camswl/bin/javadoc /usr/bin

 
 
   Those last bunch of commands are to make links in the /usr/bin folder to the programs which are actually in /opt/OpenJDK-camswl/bin/
 
   After doing this, Java was working.    I could compile and run Java programs!
 
   Next up:  Tomcat!
 


Compiling Tomcat from Source on Plugbox Linux

 OK, so I’m going to try for TomCat.   To do that I’m working from this page of the apache website.

  A Prerequisite for Tomcat is Apache Ant, which as I understand it is a program made to do the same job as the venerable 'make' utility.    This is a good thing, because large complicated makefiles are about the most confusing things I've had to deal with.

Apache Ant


Ant seems to be written in Java.  So hopefully if my jdk is running I will be able to get ant to work.

 As it said to do on the Apache Tomcat Building page, I have downloaded the binary apache-ant-1.6.5-bin.tar.bz from the Apache Ant Historical downloads page. I have downloaded and unpacked apache ant 1.6.5 because I’m going to try for Tomcat 6.0. Why am I attempting to install Tomcat 6.0, when 7.0 is available? Because the folks at maemo.org specifically reported that Tomcat 6 worked. Probably 7 will work too, but at this point I want to do the simplest thing.
 
I unpacked the archive using the 
 
tar jxf
 
command like above with the openJDK files. 
 
 

Installing Ant


cd /usr/local
wget archive.apache.org/dist/ant/binaries/apache-ant-1.6.5-bin.tar.bz2
tar jxf apache-ant-1.6.5-bin.tar.bz2
mv -v apache-ant-1.6.5 ant
rm apache-ant-1.6.5-bin.tar.bz2

 

Now I have to put the bin folder in the path.

To do that I’m going to edit /etc/profile


# Set our default path
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
export PATH

I’m changing this to

# Set our default path
PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/ant/bin"
export PATH


and at the end of the file I added the following to set the environment variables JAVA_HOME and ANT_HOME


# add JAVA_HOME and ANT_HOME
ANT_HOME="/usr/local/ant"
JAVA_HOME="/opt/OpenJDK-camswl"
export ANT_HOME JAVA_HOME

Now I’m rebooting to see if the path changed and the environment variables changed.

ant -diagnostics >ant_diagnostics



-------------------------------------------
Tasks availability
-------------------------------------------
image : Missing dependency com.sun.media.jai.codec.FileSeekableStream
sshexec : Missing dependency com.jcraft.jsch.UserInfo
scp : Missing dependency com.jcraft.jsch.UserInfo
jdepend : Missing dependency jdepend.xmlui.JDepend
junit : Missing dependency junit.framework.Test

-------------------------------------------
org.apache.env.Which diagnostics
-------------------------------------------
Not available.
Download it at http://xml.apache.org/commons/


-----------
OK, I’m not sure if that means Ant is broken, or not.   I’ll just forge ahead assuming that Ant is ok.
 

Installing SubVersion revision Control System

 
We need to do this so we can get the source code for Tomcat out of their repository.
 

To get the TomCat source I need SVN.   Luckily, there is a package available with pacman:

pacman -S subversion

ok, this seems to be working at least svn --help gives a help page...


cd
mkdir tomcat_build
cd tomcat_build
svn export http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/
cd trunk
ant download
ant


7 minutes and 22 seconds later -
BUILD SUCCESSFUL
 
 

Now Tomcat has supposedly been built, but it needs to be configured before it will run.  On the next page, I'll cover how I got it to actually run.


Getting Tomcat Running After Building It

 

 

  When I finished building, the output folder of the building process was left in a subdirectory of root's home folder.   I decided a more reasonable place to put it would be in /user/local/tomcat

 


mkdir /usr/local/tomcat
cd
cd tomcat_build
cd trunk/output/build
cp -dprv * /usr/local/tomcat

 

 I think that I have to make another environment variable


CATALINA_HOME which points to the Tomcat folder /usr/local/tomcat

So I will edit the /etc/profile script.  Now the end of the script file looks like:

# add JAVA_HOME and ANT_HOME
ANT_HOME="/usr/local/ant"
JAVA_HOME="/opt/OpenJDK-camswl"
CATALINA_HOME="/usr/local/tomcat"
export ANT_HOME JAVA_HOME CATALINA_HOME

Here I am trying to start it up. From the /usr/local/tomcat/bin folder I'm going to run the script startup.sh
 
 
[root@Plugbox bin]# ./startup.sh 
 
 

 Now to see if it is working, you can type your IP address into your browser and add 

 

:8080 to the address.  This should take you to a tomcat page if it is working.

 

Tomcat Running on a Tonido Plug Computer 

 

 

Sweet!   Tomcat runs!

Configuring Tomcat

 

 ok I think I want to turn down the memory used.   I don't know what the default settings are, but I know that my Tonido plug doesn't have nearly as much RAM as a typical desktop, so it is possible the defaults are going to be wasteful.


I learned from this blog page.


CATALINA_OPTS=”-Xmx16m”
export CATALINA_OPTS

so now at the end of /etc/profile
I have:

# add JAVA_HOME and ANT_HOME
ANT_HOME="/usr/local/ant"
JAVA_HOME="/opt/OpenJDK-camswl"
CATALINA_HOME="/usr/local/tomcat"
CATALINA_OPTS="-Xmx16m"
export ANT_HOME JAVA_HOME CATALINA_HOME CATALINA_OPTS

So when I visited
192.168.1.19:8080 I was viewing the tomcat page!

You are not authorized to view this page. If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp.
For example, to add the manager-gui role to a user named tomcat with a password of s3cret, add the following to the config file listed above.


<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>


So I went to my tomcat/conf folder and edited tomcat-users.xml
Near the end, but before the </tomcat-users> line I added:

<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcatuser" password="mygirlfriendsname" roles="manager-gui,manager-script"/>
 
 

 Getting Tomcat to start up at boot time.

 
 I read the official Apache Tomcat page on how to do this.  They talk about running Tomcat as a daemon.   To do this, you need to use something called the jsvc tool, which sounded like another opportunity to waste hours of time.
 
  So instead, I just added the startup to /etc/rc.local file.   Since I am not much of a Linux person, I don't really understand what a 'daemon' is or why I'd want to go that way over just putting in a startup script.
 
  Here is a page which describes what rc.local is for and a lot about the Arch Linux boot process. 
 
  However, this appears to work just fine:
 
This is what my /etc/rc.local file looked like after I added the tomcat startup line. 

#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
/usr/local/tomcat/bin/startup.sh
 
 
--
And then in /etc/rc.local.shutdown I have:
 
#!/bin/bash
#
# /etc/rc.local.shutdown: Local shutdown script.
#

/usr/local/tomcat/bin/shutdown.sh

 

 Mysql

   A pretty standard thing to have on your server is mysql.    I have not done this yet, but arch linux has this page on how to set it up with Apache and Tomcat.
 
 
First I updated my sources

packman -Sy

pacman -Ss mysql

lists a package which looks right so I’m going to install it on the Tonido.

pacman -S mysql

-----
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h Plugbox password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

Optional dependencies for mysql
   perl-dbi
   perl-dbd-mysql

---

ok, so I guess I’ll start up the mysql daemon

[root@Plugbox usr]#  cd /usr
[root@Plugbox usr]# ./bin/mysqld_safe &
[1] 10285
[root@Plugbox usr]# 101130 16:47:26 mysqld_safe Logging to '/var/lib/mysql/Plugbox.err'.
101130 16:47:27 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql


and now I’ll run the secure_installation

./bin/mysql_secure_installation

This asked me for the current password, which is blank for a new installation.
Then it asked me to choose a password for root which I did.  Then it recommended some security things to do, which I did.

---
This page has some good info about how to set up mysql:

https://wiki.archlinux.org/index.php/MySQL

ok, so it looks like a file called ‘mysqld’ has already been added to my  /etc/rc.d folder.  So all I need to do is add mysql to the list of stuff to startup.

so I edited /etc/rc.conf and added mysqld to the list of daemons:

DAEMONS=(syslog-ng network netfs crond sshd mysqld httpd bftpd)

I made sure it was running by logging in as root:

mysql -p -u root

After putting in my password, it looked like it was running fine.

I decided to turn on the listing on port 3306 or whatever in case I will need that.  But I made the access work only from localhost by editing the /etc/hosts.allow file:

#
# /etc/hosts.allow
#
sshd: ALL
mysqld: 127.0.0.1 : ALLOW
# End of file


and I went to /etc/mysql/my.cnf

And commented out the line
skip-networking
 
 

   

 How to Reach Me

    I welcome correction, comments and suggestions. 
Reaching the Author 
 

 

 

 

Last Updated on Wednesday, 01 December 2010 14:06
 

Sponsored Links

Bold Inventions, Powered by Joomla!; Joomla templates by SG web hosting