Daily Archives: June 5, 2009

screen in FreeBSD default to csh as suppose to bash (preferred)

0
Filed under BSD
Tagged as

After changing bash shell to a new user using chsh, screen needs ~/.bashrc for environment settings, which need “ln -s ~/.bash_profile ~/.bashrc”.

Forget / forgot / cannot remember root password on FREEBSD

0
Filed under BSD
Tagged as

1. reboot server
2. choose to boot into single user mode
3. mount -o rw <root partition> e.g. mount -o rw /
4. passwd <root account> e.g. passwd root
5. mount -o ro <root partition> e.g. mount -o ro /
6. reboot server again

freeBSD mysql

0
Filed under BSD, WEB-DEV-LOG
Tagged as

wordpress only supports mySQL so the idea of moving to PostgreSQL is done.

  • /etc/rc.conf
  • Add the following line to rc.conf
  • mysql_enable=”YES”
  • mysql_dbdir=”/opt/database/mysql” # define your own DB Dir.

[root@soap /usr/ports/databases/mysql51-server]# /usr/local/bin/mysql_install_db
Installing MySQL system tables…
090605 23:22:43 [Warning] Forcing shutdown of 2 plugins
OK
Filling help tables…
090605 23:22:43 [Warning] Forcing shutdown of 2 plugins
OK

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/local/bin/mysqladmin -u root password ‘new-password’
/usr/local/bin/mysqladmin -u root -h soap.bubble.net.cn password ‘new-password’

Alternatively you can run:
/usr/local/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/local ; /usr/local/bin/mysqld_safe &

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

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

The latest information about MySQL is available at www.mysql.com/
Support MySQL by buying support/licenses from shop.mysql.com/

The Soulforged insane blog
Kill a man, you are a murderer. Kill many, you are a conqueror. Kill ‘em all and you are a god.’Make the mysql directory owned by the user, ‘mysql‘.

chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/

FROM HERE

shell> /usr/local/etc/rc.d/mysql-server start

Customize MySQL’s my.cnf File and Post Install

MySQL’s default my.cnf file is available at /usr/local/share/mysql, copy the cnf file which suit your usage to the database data directory you have defined earlier on /etc/rc.conf. Stop and start MySQL if you make any changes on my.cnf file.

By default, MySQL doesn’t set password for system root account, it’s advice to set a password for your MySQL’s root account;

shell> mysqladmin -u root password

Now, you can access to your MySQL database

shell> mysql -u root -p (enter your password when prompt)
shell> Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.0.77 FreeBSD port: mysql-server-5.0.77_1

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

mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| test |
+——————–+
3 rows in set (0.00 sec)

If you do not want to use root, you can create an account by your own username;

mysql> CREATE USER ‘huhu’@'localhost’ IDENTIFIED BY ‘your_password’;
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘huhu’@'localhost’ WITH GRANT OPTION;

That’s the quick install of MySQL5 on FreeBSD Server, it’s quick isn’t it?

 ps u | grep mysql


FreeBSD process size restrictions

0
Filed under BSD
Tagged as
FROM HERE

FreeBSD limits the size of a process to 512MB, even if you have much more RAM available on the system. So you may get an error such as this:

Out of memory (Needed 16391 bytes)

In current versions of FreeBSD (at least 4.x and greater), you may increase this limit by adding the following entries to the /boot/loader.conf file and rebooting the machine (these are not settings that can be changed at run time with the sysctl command):

kern.maxdsiz="1073741824" # 1GB
kern.dfldsiz="1073741824" # 1GB
kern.maxssiz="134217728" # 128MB

FROM HERE
kern.maxfiles=65535
kern.maxfilesperproc=56384
kern.maxproc=50000

vfs.vmiodirenable=1
net.inet.tcp.msl=2000

net.inet.tcp.rfc1323=1
net.inet.tcp.delayed_ack=0
net.inet.tcp.restrict_rst=1
kern.ipc.maxsockbuf=2097152
kern.ipc.somaxconn=4096
kern.ipc.maxsockets=52328
net.inet.ip.portrange.first=20000

net.inet.ip.portrange.last=65535
net.inet.ip.portrange.hifirst=20000
net.inet.ip.portrange.hilast=65535

FreeBSD Display Information About The System Hardware

0
Filed under BSD
Tagged as

FROM HERE

1) Determining the Hardware Type/platform:
# uname -m

2) Determining machine processor architecture:
# uname -p

3) Determining FreeBSD release level:
# uname -r
Generally, following command is use to get all info at a time:
# uname -mrs
Output:

FreeBSD 5.0-RELEASE i386

4) Determining CPU information such as speed, make etc
# dmesg | grep CPU
Output:

CPU: Pentium 4 (1716.41-MHz 686-class CPU)
acpi_cpu0: on acpi0
acpi_cpu: CPU throttling enabled, 8 steps from 100% to 12.5%

5) Determining real and available memory to FreeBSD:
# dmesg | grep memory
Output:

real memory = 201326592 (192 MB)
avail memory = 188555264 (179 MB)

Alternatively, try following command to grab memory information:
# sysctl -a | grep hw.*mem
# sysctl -a | grep mem
Output:

hw.physmem: 194985984
hw.usermem: 167641088
hw.cbb.start_memory: 2281701376

Note systcl has more info, just type the sysctl command to see rest of all information:
# sysctl -a | less

6) Determining how long a system has been up:
# uptime

7) Determining when a system was last rebooted or shutdown:
# last -1 reboot
# last -1 shutdown

8) Determining swap file system usage
# swapinfo -k

9) Determining who is logged in and what they are doing. Following all commands can be used. users command displays the list of all logged in users only.
# w
# who
# users

10) Find out when user was last logged in – You can use last command as follows:
# last user-name
(a) To find out user vivek was last logged, enter:
# last vivek