Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Monday, June 22, 2020

How to enable network on Ubuntu machine from terminal.

I just installed Ubuntu Server on my laptop using netboot. While installation i was connected with wireless connection. Once installation is done i was unable to get network. to work on server i need to stay connected to my server. 

But now my question was where is my network? 
How to enable network on Ubuntu machine from terminal?
What are my option to get network connectivity back?

It was really huge task for me, as i have worked on ubuntu machine long back. 

What i tried:

sudo systemctrl network-manager restart
nmcli
sudo ifup -a

None of these worked. Next i tried 

sudo netplan generate

And luckily it gave me error saying token is invalid in /etc/netplan/01-netcfg.yaml. 

So i understood problem is with configuration & the command i have to use is netplan.

Solution:

Just Updated the configuration with sudo vi /etc/netplan/01-netcfg.yaml.
and executed sudo netplan apply

yay!!!!!! am done. 

My network connection is back.

Monday, March 19, 2012

Fix for error "Network Device not managed" in ubuntu


I was configuring DHCP Server, after configuration successful i restarted my server then All Ethernet ports went down, i check Network Manager graphically it shows "Device not managed" then i checked it from terminal using
sudo /etc/init.d/networking restart
It gives me this message

* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
* Reconfiguring network interfaces...                                        
/bin/sh: cannot open /etc/iptables_rules: No such file
Failed to bring up eth0.

This was the issue i got.
Now Solution!!!

Edit the file "/etc/NetworkManager/NetworkManager.conf"
 Change managed=false to managed=true

And ececute this in terminal.
sudo killall NetworkManger
Now we can configure our ethernet/wify interface.

Saturday, February 11, 2012

Shell Script for auto-start and shutdown for a service in linux

Some services are having different starting points in linux. for example webmin: To start webmin we need to execute the command /etc/webmin/start where as all service can be started as /etc/init.d/service-name start. this is comman practice now. so we will write a shell script which will allow us to make it auto-start and shutdown for a service with comman practice & will start when we boot up the computer. lets take an example of webmin.


To make webmin automatically start when we boot up the computer,Create a file in "/etc/init.d/" directory as



sudo vi /etc/init.d/webmin

And put the following code in that file:
# Webmin auto-start
#
# description: Auto-starts webmin
# processname: webmin
# pidfile: /var/run/webmin.pid
case $1 in
start)
sh /etc/webmin start
;;
stop)
sh /etc/webmin stop
;;
restart)
sh /etc/webmin start
sh /etc/webmin stop
;;
esac
exit 0

now we need to change the file permission of this file so that it become executable.



sudo chmod 755 /etc/init.d/webmin

The now the final step is to linking this script to the startup folders with a symbolic link as.



sudo ln -s /etc/init.d/webmin /etc/rc1.d/K99webmin
sudo ln -s /etc/init.d/webmin /etc/rc2.d/S99webmin

Now we are ready with our new set of commands to start, stop & restart the service as



sudo /etc/init.d/webmin start
sudo /etc/init.d/webmin stop
sudo /etc/init.d/webmin restart

Saturday, January 7, 2012

How to Set Up an Amazon EC2 Instance

To start with Amazon Cloud we are going use the AWS Management Console. Login to the Management Console (If registered Else create an account with your credit card details and then login). On the home screen, make sure the tab EC2 is selected. then follow these steps as in images...


Now We need to select an ami so here i am going with ubuntu AMI. Here we can choose ami from amazon also in Quick start tab. But we are going with ubuntu so we will get it in community AMIs and search for your Amazon ami using AMI-ID. we can choose with or without EBS.



 Now select Instance Type, here i am going with micro instance


Now if we need to go for specific settings then we can customize but here we are going with default settings as first time.


Now Keep a name for your server as


Now We need to create a key pair & download .pem file which can be use to connect to server usingh ssh.


Now select security group which will allow us to connect/Access cloud AMI based on rules.


Now the summary of instance we have configure & chosen for Click launch to start the AMI.


Now After this step in few minute our AMI will start. Now we need to enable SSH in security group. then only we can connect to our AWS AMI as


ssh -i keypairfilename.pem ubuntu@public_address of AMI

if it ask for password provide as ubuntu further we can change it.

Wednesday, January 4, 2012

How to delete files older than certain time in linux

The find utility on linux allows us to pass in a bunch of interesting arguments, including one to execute another command on each file. We’ll use this in order to figure out what files are older than a certain time/days, and then use the rm or delete command to delete them.

Using rm command


find /path/to/files* -mtime +5 -exec rm {} \;



Note that there are spaces between rm, {}, and \;

Explanation

  • The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.

  • The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.

  • The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.


Using delete command

First goto the Directory where we have to delete the files older than certain time/day.
CD /directory/path

Now Suppose we have to delete files older than 2 hour so we will use -mmin +120 which will list out all files older than 2 hours(120 min) & then delete to delete them as

Find . -mmin +120 -delete

Now Suppose we have to delete files older than 2 day so we will use -mtime +2 which will list out all files older than 2 days  & then delete to delete them as

Find . -mtime +2 -delete

here i am using  '.' after find which is showing current directory.

 

Wednesday, December 7, 2011

FTP configuration on ubuntu using vsftpd

The configuration of the vsftpd FTP service (read as daemon ) simply requires three steps.

Step # 1: Install vsftpd


Type apt-get command to install vsftpd
$ sudo apt-get install vsftpd
Output:
Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
vsftpd
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 121kB of archives.
After unpacking 438kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com edgy/main vsftpd 2.0.4-0ubuntu5 [121kB]
Fetched 121kB in 0s (246kB/s)
Selecting previously deselected package vsftpd.
(Reading database ... 31396 files and directories currently installed.)
Unpacking vsftpd (from .../vsftpd_2.0.4-0ubuntu5_amd64.deb) ...
Setting up vsftpd (2.0.4-0ubuntu5) ...
Adding system user `ftp' with uid 106...
Adding new user `ftp' (106) with group `nogroup'.
Not creating home directory `/home/ftp'.
* Starting FTP server: vsftpd

Step # 2: Configure /etc/vsftpd.conf


The default vsftpd configuration file is /etc/vsftpd.conf. You need to edit this file using text editor such as vi:
$ sudo vi /etc/vsftpd.conf

Add the following line (uncomment line) to the vsftpd configuration file:
local_enable=YES
Above config directive will allow local users to log in via ftp

If you would like to allow users to upload file, add the following to the file:
write_enable=YES

For security you may restrict local users to their home directories. Add the following to the file:
chroot_local_user=YES

Save and close the file.

Step # 3: Restart vsftpd


To restart vsftpd type the command :
$ sudo /etc/init.d/vsftpd restart
Output:
* Stopping FTP server: vsftpd                                                                                       [ ok ]
* Starting FTP server: vsftpd [ ok ]

How do I use ftp command line utility?


Now you should be able to FTP to this server with any account that exists on the system except for the root user. From Windows or other Linux system use ftp client, type the command:
$ ftp ftp.nixcraft.in
Output:
Connected to ftp.nixcraft.in.
220 (vsFTPd 2.0.4)
Name (ftp.nixcraft.in:vivek): vivek
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/"
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 1000 1000 91798 Aug 16 08:26 apf-current.tar.gz
-rwxr-xr-x 1 1000 1000 156 Nov 10 07:05 iptables.stop
drwxr-xr-x 3 0 0 4096 Dec 23 11:11 postfix
-rw-r--r-- 1 0 0 10481942 Nov 29 23:35 webmin_1.310_all.deb
226 Directory send OK.
ftp> quit
221 Goodbye.

Open FTP port using iptables (optional)


Add following rules to your iptables script. Assuming that default incoming policy is drop. If protocol is TCP and destination port is 21 (ftp):
iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
See - How do I open open ftp port 21 using iptables for more information.

There are a large number of other configuration options available for vsftpd that can be used to fine tune ftp server. Read vsftpd.conf man page by typing following command:
$ man vsftpd.conf

& its Done

Tuesday, December 6, 2011

How to enable mod_rewrite in apache2

First install the apache with this command:

apt-get install apache2

Now use locate to find if the mod_rewrite.so is availble on your server:

updatedb
locate mod_rewrite.so

it will found in “/usr/lib/apache2/modules”

New apache follow some folders to enable and disable mods so now do this:

cd /etc/apache2/mods-enabled
touch rewrite.load
vim rewrite.load (you may use any editor to edit this file)

Now paste this following line:

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

Then edit:
/etc/apache2/sites-available/default



In case of Windows go with apache configuration file:
conf/httpd.conf


Find the following:

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


and change it to

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all


and finally restart Apache:

/etc/init.d/apache2 restart


Now Its Done!!!

Enjoy.....

Friday, October 14, 2011

Hosting multiple websites with Apache2

There are many different ways you can configure Apache to host multiple sites, ranging from the simple to the complex. Here we're only going to cover the basics with the use of the NameVirtualHost directive. The advantage of this approach is that you don't need to hard-wire any IP addresses, and it will just worktm. The only thing you need is for your domain names to resolve to the IP address of your webserver.

For example if you have an Apache server running upon the IP address 192.168.1.1 and you wish to host the three sites example.com, example.net, and example.org you'll need to make sure that these names resolve to the IP address of your server.

(This might mean that you need example.com and www.example.com to resolve to the same address. However that is a choice you'll need to make for yourself).

Since we'll be hosting multiple websites on the same host it makes a lot of sense to be very clear on the location of each sites files upon the filesystem. The way I suggest you manage this is to create a completely seperate document root, cgi-bin directory, and logfile directory for each host. You can place these beneath the standard Debian prefix of /var/www or you may use a completely different root - I use /home/www.

If you've not already done create the directories to contain your content, etc, as follows:
root@sumant:~# mkdir /home/www

root@sumant:~# mkdir /home/www/www.example.com
root@sumant:~# mkdir /home/www/www.example.com/htdocs
root@sumant:~# mkdir /home/www/www.example.com/cgi-bin
root@sumant:~# mkdir /home/www/www.example.com/logs

root@sumant:~# mkdir /home/www/www.example.net
root@sumant:~# mkdir /home/www/www.example.net/htdocs
root@sumant:~# mkdir /home/www/www.example.net/logs
root@sumant:~# mkdir /home/www/www.example.net/cgi-bin

root@sumant:~# mkdir /home/www/www.example.org
root@sumant:~# mkdir /home/www/www.example.org/htdocs
root@sumant:~# mkdir /home/www/www.example.org/logs
root@sumant:~# mkdir /home/www/www.example.org/cgi-bin

Here we've setup three different directory trees, one for each site. If you wanted to have identical content it might make sense to only create one, and then use symbolic links instead.

The next thing to do is to enable virtual hosts in your Apache configuration. The simplest way to do this is to create a file called /etc/apache2/conf.d/virtual.conf and include the following content in it:
#
#  We're running multiple virtual hosts.
#
NameVirtualHost *

(When Apache starts up it reads the contents of all files included in /etc/apache2/conf.d, and files you create here won't get trashed on package upgrades.)

Once we've done this we can create the individual host configuration files. The Apache2 setup you'll find on Debian GNU/Linux includes two directories for locating your site configuration files:
/etc/apache2/sites-available

This contains configuration files for sites which are available but not necessarily enabled.
/etc/apache2/sites-enabled

This directory contains site files which are enabled.

As with the conf.d directory each configuration file in the sites-enabled directory is loaded when the server starts - whilst the files in sites-available are completely ignored.

You are expected to create your host configuration files in /etc/apache2/sites-available, then create a symbolic link to those files in the sites-enabled directory - this will cause them to be actually loaded/read.

Rather than actually messing around with symbolic links the Debian package includes two utility commands a2ensite and a2dissite which will do the necessary work for you as we will demonstrate shortly.

Lets start with a real example. Create /etc/apache2/sites-available/www.example.com with the following contents:
#
#  Example.com (/etc/apache2/sites-available/www.example.com)
#
<VirtualHost *>
ServerAdmin webmaster@example.com
ServerName  www.example.com
ServerAlias example.com

# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /home/www/www.example.com/htdocs/

# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.example.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>


# Logfiles
ErrorLog  /home/www/www.example.com/logs/error.log
CustomLog /home/www/www.example.com/logs/access.log combined
</VirtualHost>

Next create the file www.example.net:
#
#  Example.net (/etc/apache2/sites-available/www.example.net)
#
<VirtualHost *>
ServerAdmin webmaster@example.net
ServerName  www.example.net
ServerAlias example.net

# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /home/www/www.example.net/htdocs/

# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.example.net/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>


# Logfiles
ErrorLog  /home/www/www.example.net/logs/error.log
CustomLog /home/www/www.example.net/logs/access.log combined
</VirtualHost>

Finally create the file www.example.org:
#
#  Example.org (/etc/apache2/sites-available/www.example.org)
#
<VirtualHost *>
ServerAdmin webmaster@example.org
ServerName  www.example.org
ServerAlias example.org

# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /home/www/www.example.org/htdocs/

# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.example.org/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>


# Logfiles
ErrorLog  /home/www/www.example.org/logs/error.log
CustomLog /home/www/www.example.org/logs/access.log combined
</VirtualHost>

Now we've got:

Three directories which can be used to contain our content.
Three directories which can be used to contain our logfiles.
Three directories which can be used to contain our dynamic CGI scripts.
Three configuration files which are being ignored by Apache.

To enable the sites simply run:
root@sumant:~# a2ensite www.example.com
Site www.example.com installed; run /etc/init.d/apache2 reload to enable.

root@sumant:~# a2ensite www.example.net
Site www.example.net installed; run /etc/init.d/apache2 reload to enable.

root@sumant:~# a2ensite www.example.org
Site www.example.org installed; run /etc/init.d/apache2 reload to enable.

This will now create the symbolic links so that /etc/apache2/sites-enabled/www.example.org, etc, now exist and will be read.

Once we've finished our setup we can restart, or reload, the webserver as the output above instructed us to do with:
root@sumant:~# /etc/init.d/apache2 reload
Reloading web server config...done.
root@sumant:~#

Now Your server is ready Go & test it.

DNS Server setup using Bind DNS on Ubuntu Server

To Setup Bind server we need to install Bind Package using
sudo apt-get install bind9

Configure the main Bind files. Usually, if you install Bind from the source code, you will have to edit the file named.conf. However, Ubuntu provides you with a pre-configured Bind, so we will edit another file:
sudo vi /etc/bind/named.conf.local

Add  this code there
zone "example.com" {
type master;
file "/etc/bind/db.example.com";
};

Now, let's add the zone definition files (replace example.com with your domain name so create a zone definition file as
sudo vi /etc/bind/example.com.db

Add this code there
;
; BIND data file for local loopback interface
;
$TTL    3600
@    IN    SOA    example.com. admin.example.com. (
11
604800
86400
2419200
604800 )
;
@       IN      NS      ns1.example.com.
@       IN      A       192.168.0.1
ns1     IN      A       192.168.0.1
ns2     IN      A       192.168.0.1
www     IN      A       192.168.0.1

Save it and Restart bind Server :
sudo /etc/init.d/bind9 restart

Now Our name server is ready as
ns1.example.com
ns2.example.com

if it asks for IP address just provide the IP address of your server in oue case 192.168.0.1

Now its Done.

Tuesday, October 11, 2011

How To Safely Uninstall Ubuntu From A Windows Dual-Boot PC

If you have been using your Linux system for some time, chances are you would have created files you wouldn’t want to loose. In such a case, you can boot into Linux, backup your files (check out your Home directory) on an external device or onto a Windows partition.

Alternatively if you somehow managed to mess up and can’t boot into Linux, you can use ext2 IFS which allows you access to your Linux paritions. It can only read ext2 and ext3 filesystems though. If you are using other filesystems, you would have to look around a bit for a similar application. In any case, you can always boot from a Linux live CD to backup files if everything else fails.

Delete Linux Partitions


Next step: delete every Linux partition. That would include everything – boot, swap, home, whatever way you set up your system, it is time to delete all Linux partitions. There are a couple of ways to achieve this, easiest being from within Windows’ Computer Management. You need to:



  • Log in to an account with administrative privileges.

  • Right click on My Computer, click ‘Manage’.

  • Choose ‘Disk Management’ listed under ‘Storage’ and you will see all of your partitions listed there.



Next, you need to identify Linux partitions. The Linux partitions generally don’t have a file system listed with them if Windows doesn’t recognize it, so this can serve as a clue. Other ways can be identifying by size or partition number. You can use partition managers, these are generally better at identifying filesystems. Go ahead, delete the partitions, just make sure you delete the correct ones. Linux is gone and so is GRUB, which allowed you to choose operating system to use at boot time. So currently, you cannot boot into any other operating system, without some help. We are going to fix that soon.

Restore MBR


As we noted, GRUB is gone and so is the ability to boot into Windows. You would now need to boot from the Windows CD/DVD to restore the Master Boot Record.  Here are the steps:

  • Boot from Windows CD/DVD and choose “Repair” when it shows up.



  • Choose command prompt on the resulting screen and run the following two commands:

    • bootrec /fixmbr

    • bootrec /fixboot

XP users need to run the recovery console from Windows XP CD and then type fixmbr when at the command prompt.

Reclaim free space


Restart now, remove the CD and you should be able to boot into your Windows installation. Once there, you should go ahead and reclaim the unpartitioned free space which was previously occupied by Linux. Doing so is simple and straight forward:

  • Fire up Disk Management as before.

  • Right-click on the unparitioned space, choose new partition or new logical drive.

  • Specify the size and other options according to your needs and you are done.

The free space should now be accessible from My Computer like any other partition. Alternatively, you can create multiple partitions from the free space or resize existing partitions to suit your needs.

Monday, October 10, 2011

Basic FTP Server Setup with vsftpd on Ubuntu

It’s pretty simple to install and to a basic configuration of an FTP server on Ubuntu. By default Ubuntu uses a package called vsftpd as an FTP server, which is currently the most popular FTP package for Linux systems. To install the vsftpd package, use the following command at the Terminal:

sudo apt-get install vsftpd

Follow the default prompts, and the vsftpd server will be installed on your computer. Generally, the default configuration for vsftpd is pretty secure, and good enough for casual use. Anonymous users are blocked, and no one can write files to the server (or, in FTP terminology, no one can upload files to the server). Anyone with a system account will be able to connect to the FTP server and download, though not upload, files.

If you want to change any settings, the configuration file for vsftpd is /etc/vsftpd.conf. Like any other configuration file, you can edit it with vi:

sudo vi /etc/vsftpd.conf

(If you’re using the desktop version of Ubuntu, you can of course use the graphical gedit editor.)

The vsftpd.conf file contains a large number of “directives” that govern how the server behaves and operates. If you want to change its configuration, you’ll need to alter the directives.

If you want users to be able to write files to your FTP server, change this directive:

#write_enable=YES

To this:

write_enable=YES

With the write_enable directive set to YES, users will be able to upload files to your FTP server. Note, however, that they will only be able to do so if they have proper permissions to the directories in question. They’ll be able to upload files to their home directories, but not, for instance /var or /usr.

Anonymous access is controlled with this directive:

anonymous_enable=NO

Under no circumstances should you allow anonymous access to your FTP server, especially if it is accessible from the Internet! There are certain circumstances when you might find it useful, but you should only enable it if you know exactly what you are doing. Generally, it is almost always best to keep anonymous_enable set to NO.

If you make any changes to the file, switch vi to command mode, save the changes, and then exit vi. Then restart the vsftpd server so it reads its new directives:

sudo service vsftpd restart

You can then test your Ubuntu machine’s FTP service from the server’s command line:

ftp 127.0.0.1

The FTP client will ask for your username. Enter that, and then the client will ask for your password. Enter that as well, and you should then see the FTP prompt, which looks like this:

ftp>

If you see that, you know the server is working. You can return to the regular command line with this command:

exit

Tuesday, September 20, 2011

sun JDK installation on ubuntu

three steps to install sun jdk on ubuntu


sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

Friday, September 16, 2011

How to add a new user to Webmin from shell via (bash,sh)

You might search for a way to add a new user to your Webmin without bothering using the Webmin user interface or you simply prefer using shell for adding the new user to Webmin just like I do.

1.In order to manually add a new user to webmin you will have to edit webmin’s /etc/webmin/miniserv.users which is the default miniserv.uesrs location in many Linux distributions, however in FreeBSD or other BSDs the miniserv.users file location would probably be /usr/share/etc/webmin/ or /usr/share/webmin/etc , anyways if you are adding the new user manually open the file and copy paste the line:
root:12ZWQKVLjpihs:0
to a new line, where you will have to modify the line substituting root with newusername , like so:

newusername:12ZWQKVLjpihs:0

Afterwards you will have to also edit the file /etc/webmin/webmin.acl and likewise copy paste the definitions allowing access to all recources to the root user which in webmin.acl by default are:

root: acl adsl-client apache at backup-config bacula-backup bandwidth bind8 burner cfengine change-user cluster-copy cluster-cron cluster-passwd cluster-shell cluster-software cluster-useradmin cluster-usermin cluster-webmin cpan cron custom dfsadmin dhcpd dnsadmin dovecot exim exports fdisk fetchmail file filter firewall frox fsdump grub heartbeat htaccess-htpasswd idmapd inetd init inittab ipfilter ipfw ipsec jabber krb5 ldap-client ldap-server ldap-useradmin lilo logrotate lpadmin lvm mailboxes mailcap majordomo man mon mount mysql net nis openslp package-updates pam pap passwd phpini postfix postgresql ppp-client pptp-client pptp-server procmail proc proftpd pserver qmailadmin quota raid samba sarg sendmail sentry servers shell shorewall smart-status smf software spam squid sshd status stunnel syslog syslog-ng system-status tcpwrappers telnet time tunnel updown useradmin usermin vgetty webalizer webminlog webmin wuftpd xinetd


In my case I wanted to add to the newly created newuser only acl privileges for user crontab modification and htaccess-passwd creation thus I have included in the webmin.acl file only:

newuser: cron webmin htaccess-passwd


You will also be required to change the new user webmin password to some password of your choice, to attain that in Debian Linux execute:

debian:~# /usr/share/webmin/changepass.pl /etc/webmin newusername type_your_password


On Fedora and other RPM (Redhat based linux distros) the webmin changepass.pl user password change script is located in /usr/libexec/webmin/changepass.pl therefore if you’re about to change the password for the new user on Fedora and alike, type:

fedora:~# /usr/libexec/webmin/changepass.pl /etc/webmin/ newusername your_password


In the above change password exapmles you need to substitute newusername with the user chosen to be the new username as explained earlier in the post.
Finally in order for the newly added user with the respectively configured permissions to start working in Webmin, you will have to reload the webmdaemon. In most linux distributions (including Debian), to restart webmin you will have to issue:

linux-shell:~# /etc/init.d/webmin restart


However if you’re looking for a bit more automated way instead of manually editting the miniserv.users and webmin.acl files.
2. Herein is a tiny shell script I’ve written which facilitates the new webmin user creation under a console / terminal / shell

I have written webmin-new-user.sh just for fun, and it could be greatly improved, so don’t expect too much from it it doesn’t do any checks on the input given to the script, so be sure to pass a correct input as required from the dialogs in order to be able to use the script to add new users to your webmin from bash or any other unix shell.
The script is written to work with Debian on Fedora and other rpm based distributions as well as BSD a minor tunings within the script might be necessary to make the script work.

Sources:www.pc-freak.net

Installing Webmin in Ubuntu

Webmin is a web-based interface for system administration for Unix. Using any browser that supports tables and forms (and Java for the File Manager module), you can setup user accounts, Apache, DNS, file sharing and so on.

Webmin consists of a simple web server, and a number of CGI programs which directly update system files like /etc/inetd.conf and /etc/passwd. The web server and all CGI programs are written in Perl version 5, and use no non-standard Perl modules.

Installing Webmin in Ubuntu

You can use the above procedure but if you want to install latest version you can download from webmin site download section

Prerequisites

Perl 5 interpreter and libnet-ssleay-perl

sudo apt-get install perl5 libnet-ssleay-perl

Now you need to download the latest webmin from the above downloadlink

Download ‘webmin-1.560.tar.gz’ (at the time of writing) to some location in your machine ex:- /usr/local/src

wget http://prdownloads.sourceforge.net/webadmin/webmin-1.560.tar.gz

cd /usr/local/src

sudo tar xzvf webmin-1.560.tar.gz

cd webmin-1.560

sudo sh setup.sh

This will start the installation and now it will prompt for several questions answer them as follows

Config file directory [/etc/webmin]:
Leave as default, or change as you wish

Log file directory [/var/webmin]:
Leave as default, or change as you wish

Full path to perl (default /usr/bin/perl):
Leave as default, or change as you wish

Operating system:
Enter ’6′

Version:
Enter ’6′

Web server port (default 10000):

This is where you can start to make webmin more secure then the standard install you get with apt-get, Synaptic, or RPM. Leave as default or change it to what ever port you want.

Login name (default admin):

It is ‘admin’, so you can leave it as that, or put in any name that you like.

Login password:

By creating the user above and giving it a password, you have now made it so you will not need to log into webmin with root.

Password again:

enter your password again

If you did not install ‘libnet-ssleay-perl’ you will get the following message:

‘The Perl SSLeay library is not installed. SSL not available.’ You can continue with the install, but it would be more secure if you install sslrelay.

Use SSL (y/n):y

Choose yes here

Start Webmin at boot time (y/n):y

select here y

At this point it is going to configure things, install things, and create things…

It will then tell you that you can log in to https://hostipaddress:10000 and to accept the certificate.

Webmin User Password Change

If you want to change root password in webmin use this included Perl script:

sudo /usr/share/webmin/changepass.pl /etc/webmin root

MySql-Apache-PHP Installation on Ubuntu server

The way to install a php server with apache & mysql support on ubuntu machine is as follow:

MySql
apt-get install mysql-server mysql-client
New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword

Apache
apt-get install apache2

Php
apt-get install php5 libapache2-mod-php5
/etc/init.d/apache2 restart

check for php-MySql Packages
apt-cache search php5

apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

/etc/init.d/apache2 restart

apt-get install phpmyadmin
Web server to reconfigure automatically: <-- apache2
Configure database for phpmyadmin with dbconfig-common? <-- No

Note:use sudo where ever required!!!