Samba on Ubuntu

Server

If you wish your computer to act as a Samba server (act as a file or printer server) then install, SAMBA by any method.

$ apt-get install samba

Variable

Definition

Client variables

%a

Client’s architecture (see Table 6-1)

%I

Client’s IP address (e.g., 172.16.1.2)

%m

Client’s NetBIOS name

%M

Client’s DNS name

User variables

%u

Current Unix username

%U

Requested client username (not always used by Samba)

%H

Home directory of %u

%g

Primary group of %u

%G

Primary group of %U

Share variables

%S

Current share’s name

%P

Current share’s root directory

%p

Automounter’s path to the share’s root directory, if different from %P

Server variables

%d

Current server process ID

%h

Samba server’s DNS hostname

%L

Samba server’s NetBIOS name

%N

Home directory server, from the automount map

%v

Samba version

Miscellaneous variables

%R

The SMB protocol level that was negotiated

%T

The current date and time

%$var

The value of environment variable var


Samba Server Manual Configuration : editing /etc/samba/smb.conf

The file *smb.conf* is divided in several sections:

* Global Settings
* Debugging/Accounting
* Authentication
* Printing
* File sharing
* Misc
* Share Definitions

First we will introduce three basic configuration options that can appear in
the [global] section of the smb.conf file:


1) Global Settings

[global]

=> # "Server configuration parameters"
netbios name = (Computer NAME)
server string = (Short Details of PC)Samba %v on %L
workgroup = (WORKGROUP)
encrypt passwords = yes
      
=> # "Networking configuration options"
hosts allow = 192.168.220. 134.213.233.
hosts deny = 192.168.220.102
interfaces = 192.168.220.100/255.255.255.0 \
134.213.233.110/255.255.255.0
bind interfaces only = yes
(bind above mentioned interface only)

=>
# "Virtual Server Configuration Options
"
netbios aliases = sales accounting admin ( used to give the Samba server
more than one NetBIOS name
)
include = /usr/local/samba/lib/smb.conf.%L



=>
# "Logging Configuration Options
"
log level = 2 (log levet 1 - 10 {As u select higher level u will get
more information.})

log file = /var/log/samba.log.%m
max log size = 50 (in KB)
debug timestamp = yes/no

debug timestamp
= 2 ( numeric (0-10) )
syslog only = yes/no (uses syslog entirely if yes )

=>
# "Authentication of Clients
"
security = (share/user/server/domain)



2) Share Definitions



[data]
path = /export/samba/data (Path to Share Folder)
comment = Data Drive (Share Name)
volume = Sample-Data-Drive (Any Name)
read only = yes/no
writable = yes /no



Client

If you want to connect to a samba server (Windows server or an Ubuntu server running samba) you have two options, you can use the smbclient command or you can directly mount the samba file system via “smbfs”.

(A) smbfs

This package allows clients to mount samba file shares allowing them to act as local disks and thus Most people will prefer this method. Install, by any method, “smbfs”

$ apt-get install smbfs

Advertisements

Mysql Replication

# MySQL replication MASTER setting #

server-id = 1
log-bin = /var/log/mysql/binary/mysql-bin.log
binlog-do-db = student
binlog-ignore-db = mysql
log = /var/log/mysql/mysql.log

SHELL> mkdir /var/log/mysql/

SHELL> chown mysql:mysql -R /var/log/mysql/

SHELL> mysql -u root -p
Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 950
Server version: 5.0.45-community-log MySQL Community Edition (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| cPanel             |
| cphulkd            |
| devendra           |
| eximstats          |
| horde              |
| leechprotect       |
| mysql              |
| pleskmods          |
+——————–+
9 rows in set (0.00 sec)

mysql> create database student;
Query OK, 1 row affected (0.03 sec)

mysql> show databases;
+——————–+
| Database           |
+——————–+
| information_schema |
| cPanel             |
| cphulkd            |
| devendra           |
| eximstats          |
| horde              |
| leechprotect       |
| mysql              |
| pleskmods          |
| student            |
+——————–+
10 rows in set (0.00 sec)

mysql> use student;
Database changed

mysql> create table class ( rollno INT(5) NOT NULL PRIMARY KEY AUTO_INCREMENT , name VARCHAR(30) );
Query OK, 0 rows affected (0.32 sec)

mysql> DESC class;
+——–+————-+——+—–+———+—————-+
| Field  | Type        | Null | Key | Default | Extra          |
+——–+————-+——+—–+———+—————-+
| rollno | int(5)      | NO   | PRI | NULL    | auto_increment |
| name   | varchar(30) | YES  |     | NULL    |                |
+——–+————-+——+—–+———+—————-+
2 rows in set (0.03 sec)

mysql> INSERT INTO class VALUES (”, ‘Arun Bagul’);
Query OK, 1 row affected, 1 warning (0.01 sec)

mysql> SELECT * FROM class;
+——–+————+
| rollno | name       |
+——–+————+
| 1      | BHAVESH    |
+——–+————+
1 row in set (0.00 sec)

mysql> INSERT INTO class VALUES (”, ‘Suhail Thakur’);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> INSERT INTO class VALUES (”, ‘Bhavesh Vala’);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> SELECT * FROM class;
+——–+—————+
| rollno | name          |
+——–+—————+
| 1      | BHAVESH       |
| 2      | Suhail Thakur |
| 3      | Bhavesh Vala  |
+——–+—————+
3 rows in set (0.00 sec)

mysql> GRANT REPLICATION SLAVE ON *.* TO ‘replication’@’192.168.0.%’ IDENTIFIED BY ‘mypwd’;
Query OK, 0 rows affected (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> SHOW MASTER STATUS;
+——————+———-+—————–+——————+
| File             | Position | Binlog_Do_DB    | Binlog_Ignore_DB |
+——————+———-+—————–+——————+
| mysql-bin.000002 | 98       | student,student | mysql,mysql      |
+——————+———-+—————–+——————+
1 row in set (0.02 sec)

mysql>

mysql> SHOW PROCESSLIST;
+—-+——-+———–+——-+———+——+————+————————–+
| Id | User  | Host      | db    | Command | Time | State      | Info                     |
+—-+——-+———–+——-+———+——+————+————————–+
| 31 | root  | localhost | NULL  | Query   | 0    | NULL       | SHOW PROCESSLIST         |
| 41 | horde | localhost | horde | Sleep   | 0    |            | NULL                     |
| 42 | horde | localhost | horde | Query   | 1    | statistics | SELECT session_data FROM horde_sessionhandler WHERE session_id = ‘f70a7d64bd353917679814813a513c8f’                |
| 43 | horde | localhost | horde | Query   | 1    | statistics | SELECT session_data FROM horde_sessionhandler WHERE session_id = ‘f70a7d64bd353917679814813a513c8f’                |
+—-+——-+———–+——-+———+——+————+————————–+
4 rows in set (0.00 sec)

mysql> SHOW PROCESSLIST\G;
*************************** 1. row ***************************
Id: 31
User: root
Host: localhost
db: NULL
Command: Query
Time: 0
State: NULL
Info: SHOW PROCESSLIST

1 row in set (0.00 sec)

mysql>

SHELL> /etc/init.d/mysql restart

Shutting down MySQL… [ OK ]
Starting MySQL [ OK ]

SHELL> cd /var/log/mysql/binary/

SHELL> ls
mysql-bin.000001 mysql-bin.index

# MySQL replication SLAVE setting #

server-id=3
master-port=3306
master-host=192.168.XXX.XXX
master-user=replication
master-password=mypwd
master-connect-retry=60
replicate-do-db=student

SHELL> mysqladmin create student -u admin -p
Enter password:

SHELL> mysql -u admin -p student show databases;
+———–+
| Database  |
+———–+
| horde     |
| mysql     |
| pleskmods |
| psa       |
| student   |
+———–+
5 rows in set (0.00 sec)

mysql> use student;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+——————-+
| Tables_in_student |
+——————-+
| class             |
+——————-+
1 row in set (0.00 sec)

mysql> select * from class;
+——–+—————+
| rollno | name          |
+——–+—————+
| 1      | Arun Bagul    |
| 2      | Suhail Thakur |
| 3      | Bhavesh Vala  |
| 4      | Nishit Shah   |
+——–+—————+
4 rows in set (0.00 sec)

mysql>

mysql> CHANGE MASTER TO MASTER_HOST=‘192.168.XXX.XXX’, MASTER_USER=’replication’ , MASTER_PASSWORD=’mypwd’,MASTER_LOG_FILE=’mysql-bin.000004′,MASTER_LOG_POS=412;
Query OK, 0 rows affected (0.01 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status\G;

*************************** 1. row ***************************
Slave_IO_State: Waiting for 192.168.XXX.XXX
Master_Host: 192.168.XXX.XXX
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000103
Read_Master_Log_Pos: 16995
Relay_Log_File: magnet-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000103
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB: auth,auth
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 16995
Relay_Log_Space: 98
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL

1 row in set (0.00 sec)

mysql> quit
Bye

SHELL> /etc/init.d/mysqld restart

Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]

Flex 3 for Linux

1) The entire install process consists of installing the following 2 meta packages:

=> eclipse and
=> flexbuilder_linux_install_a3_033108.bin
=> j2re1.4

2) Download the packages from the below mentioned link.

=> j2re1.4 (apt-get install j2re1.4)

=> Eclipse (download through Browser)

http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.3.2-200802211800/eclipse-SDK-3.3.2-linux-gtk.tar.gz&url=http://download.eclipse.org/eclipse/downloads/drops/R-3.3.2-200802211800/eclipse-SDK-3.3.2-linux-gtk.tar.gz&mirror_id=1

=> Flex Builder 3 Alpha

http://download.macromedia.com/pub/labs/flex/flexbuilder_linux/flexbuilder_linux_install_a3_033108.bin

3) After installing the j2re1.4 package do the following steps

=> make directory Flex-Builder in /usr/local/

$ mkdir /usr/local/Flex-Builder

=> Untar the eclipse-SDK-3.3.2-linux-gtk.tar.gz to /usr/local/Flex-Builder

$ cd /usr/local/Flex-Builder

$ tar xvfz eclipse-SDK-3.3.2-linux-gtk.tar.gz

=> first make flexbuilder_linux_install_a3_033108.bin executables

$ chmod 755 flexbuilder_linux_install_a3_033108.bin

=> now run the flexbuilder_linux_install_a3_033108.bin

$ bash flexbuilder_linux_install_a3_033108.bin

=> follow the instructions and give path of (eclips installation path and path where to install flex-builder).

=> at last go to /usr/local/Flex-Builder and run the script Adobe_Flex_builder.sh

$ bash Adobe_Flex_builder.sh

=> Enjoy the flex on linux