当前位置:操作系统 > Unix/Linux >>

FREEBSD升级及优化全攻略

make clean

  make deinstall

  make install

  make clean 即可

  升级系统源码树及ports更新/usr/share/examples/cvsup目录下stand-cvsup和ports-cvsup文件,并执行cvsup –g –L2 standard-supfile和cvsup –g –L2 ports-cvsup两个文件,升级ports树?

  CPUTYPE=i686

  CFLAGS= -O3 -pipe

  COPTFLAGS= -O3 -pipe

  升级操作系统进入/usr/src

  执行make world

  整个过程很久,需要2小时左右。

  #disable ctrl+alt+delete

  options SC_DISABLE_REBOOT

  #quota limit

  options QUOTA

  #ipfw support

  options IPFIREWALL

  options DUMMYNET

  options HZ=3000

  options IPDIVERT

  options IPFIREWALL_VERBOSE

  options IPFIREWALL_VERBOSE_LIMIT=100

  options IPSTEALTH

  options TCP_DROP_SYNFIN

  options IPFIREWALL_DEFAULT_TO_ACCEPT

  options ICMP_BANDLIM

  options ACCEPT_FILTER_DATA

  options ACCEPT_FILTER_HTTP

  #ipfilter support

  #options IPFILTER

  #options IPFILTER_LOG

  #options IPFILTER_DEFAULT_BLOCK

  再执行:

  /usr/sbin/config onlinecq

  cd ../../compile/onlinecq

  make depend

  make

  make install

  #enable_quotas="YES"

  #check_quotas="YES"

  firewall_enable="YES"

  firewall_script="/etc/rc.firewall"

  firewall_type="/etc/ipfw.rules" #create it!

  firewall_quiet="NO"

  firewall_logging_enable="YES"

  log_in_vain="NO"

  tcp_drop_synfin="NO"

  tcp_restrict_rst="YES"

  icmp_drop_redirect="YES"

  优化内核参数修改系统内核参数,实现微调:vi /etc/sysctl.conf

  kern.ipc.somaxconn=8192

  kern.ipc.maxsockbuf=2097152

  kern.maxfilesperproc=32768

  kern.maxfiles=65536

  kern.securelevel=-1

  net.inet.tcp.sendspace=65536

  net.inet.tcp.recvspace=32768

  net.inet.udp.maxdgram=57344

  net.inet.icmp.drop_redirect=1

  net.inet.icmp.log_redirect=0

  

  net.inet.ip.redirect=0

  net.inet6.ip6.redirect=0

  net.inet.icmp.icmplim=100

  net.inet.tcp.always_keepalive=0

  net.inet.tcp.delayed_ack=0

  net.inet.tcp.log_in_vain=0

  net.inet.udp.log_in_vain=0

  net.inet.tcp.blackhole=2

  net.inet.udp.blackhole=1

  net.local.stream.sendspace=65535

  net.local.stream.recvspace=32768

  net.inet.ip.fastforwarding=1

  vfs.vmiodirenable=1

  make clean

  make deinstall

  make WITH_OPENSSL=yes WITH_LINUXTHREADS=yes BUILD_OPTIMIZED=yes install 或者使用下面可参考的编译参数:BUILD_STATIC=yes

  编译成静态执行版本

  make clean

  更改mysql的root密码:

  mysqladmin –uroot –p password 123456

  生成/etc/my.cnf,使用如下命令:

  vi /etc/my.cnf

  [client]

  #password = your_password

  port = 3306

  socket = /tmp/mysql.sock

  [mysqld]

  skip-innodb

  skip-locking

  skip-networking

  set-variable = port=3306

  set-variable = socket=/tmp/mysql.sock

  set-variable = back_log=50

  set-variable = connect_timeout=3

  set-variable = key_buffer=128M

  set-variable = max_connections=1000

  set-variable = max_allowed_packet=1M

  set-variable = net_buffer_length=8K

  set-variable = wait_timeout=3

  set-variable = read_buffer_size=1M

  set-variable = sort_buffer_size=1M

  set-variable = table_cache=256

  set-variable = myisam_sort_buffer_size=32M

  set-variable = log_slow_queries=/var/log/log_slow_queries.log

  #log-bin

  server-id = 1

  [mysqldump]

  quick

  set-variable = max_allowed_packet=16M

  [mysql]

  no-auto-rehash

  # Remove the next comment character if you are not familiar with SQL

  #safe-updates

  [isamchk]

  set-variable = key_buffer=20M

  set-variable = sort_buffer=20M

  set-variable = read_buffer=2M

  set-variable = write_buffer=2M

  [myisamchk]

  set-variable = key_buffer=20M

  set-variable = sort_buffer=20M

  

  set-variable = read_buffer=2M

  set-variable = write_buffer=2M

  [mysqlhotcopy]

  interactive-timeout

  make clean

  make deinstall

  make install

  make clean

  新建立一个system的数据库备用。

  make clean

  make deinstall

  make WITH_MYSQL=1 install 或者使用下面可参考的编译参数:WITH_LANG=simplified-chinese

  使用简体中文语言包

  make clean配置pure-ftpd,主要需要做以下的工作:

  cp /usr/local/etc/pure-ftpd.conf.sample /usr/local/etc/pure-ftpd.conf

  cp /usr/local/etc/pureftpd-mysql.conf.sample /usr/local/etc/pureftpd-mysql.conf

  再修改/usr/local/etc/pure-ftpd.conf的如下部份为:

  NoAnonymous yes

  MySQLConfigFile /usr/local/etc/pureftpd-mysql.conf

  再修改/usr/local/etc/pureftpd-mysql.conf的如下部份为您的设定值:

  # Mandatory : user to bind the server as.

  MYSQLUser demo

  # Mandatory : user password. You must have a password.

  MYSQLPassword demo

  # Mandatory : database to open.

  MYSQLDatabase demo

  再进入使用mysql –uroot –p123456 进入mysql的文本方式?

  使用如下命令建立新表:

  use system;

  DROP TABLE IF EXISTS users;

  CREATE TABLE users (

  User varchar(16) NOT NULL default '',

  status enum('0','1') NOT NULL default '0',

  Password varchar(64) NOT NULL default '',

  Uid varchar(11) NOT NULL default '-1',

  Gid varchar(11) NOT NULL default '-1',

  Dir varchar(128) NOT NULL default '',

  ULBandwidth smallint(5) NOT NULL default '0',

  DLBandwidth smallint(5) NOT NULL default '0',

  comment tinytext NOT NULL,

  ipaccess varchar(15) NOT NULL default '*',

  QuotaSize smallint(5) NOT NULL default '0',

  QuotaFiles int(11) NOT NULL default 0,

  PRIMARY KEY (User),

  UNIQUE KEY User (User)

  ) TYPE=MyISAM;

  /usr/local/www/data

  chmod –R 755 /usr/local/www/data/pureftpd_php_manager

  再加入一个普通用户和一个群组,以供ftp使用:

  

  pw groupadd ftpusers

  pw useradd ftpuser –g ftpusers –s /sbin/nologin

  记住他们的uid和gid号,备用!

  进入并编辑pureftp.config.php文件

  更改里面的如下行:

  $PUREFTP_CONFIG_FILE = '/usr/local/etc/pureftpd-mysql.conf';^M
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,