Posts tagged ‘linux’

Amazon / AWS / EC2 linux version

cat /proc/version

Linux version 2.6.35.11-83.9.amzn1.x86_64 (mockbuild@build-31003.build) (gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) ) #1 SMP Sat Feb 19 23:42:04 UTC 2011

 

file /bin/bash

/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

 

cat /proc/cpuinfo

 

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Xeon(R) CPU           E5430  @ 2.66GHz
stepping	: 10
cpu MHz		: 2659.998
cache size	: 6144 KB
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu tsc msr pae cx8 cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht pbe syscall nx lm constant_tsc up arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm tpr_shadow vnmi flexpriority
bogomips	: 5319.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 38 bits physical, 48 bits virtual
power management:

 

login remote ssh delay 等很久

改 /etc/ssh/sshd_config

加一行:

UseDNS no

amazon aws ami LAMP / NGINX / PHP / memcache steps

// —–


Using NGINX + PHP5-FPM
sudo apt-get install nginx php5-fpm php5-mysql
cd /etc/init.d/
sudo service apache2 stop
sudo update-rc.d -f apache2 remove

http://yoodey.com/how-install-configure-nginx-php-fpm-memcached-work-drupal-7-ubuntu-1010-maverick

Install Memcached
sudo apt-get install memcached libmemcached-dev php5-memcached php5-memcache

// ====================

Getting a new virtual machine up and running from the default AMI is easy.  Here’s my cookbook:
Install basic services

    yum install mysql mysql-server mysql-devel
    yum install httpd httpd-devel
    yum install php php-devel php-mysql php-gd php-dom php-pear php-json
    yum install svn

Configure those services to start at boot

    chkconfig –level 345 httpd on
    chkconfig –level 345 mysqld on
    chkconfig –list

Install APC

I couldn’t find a package, and this bug report explains why we have to use the beta.

    yum install gcc pcre-devel
    pecl install apc-beta
    echo extension=apc.so > /etc/php.d/apc.ini

Install memcached

    yum install libevent libevent-devel
    curl -O http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
    cd memcached-1.4.5
    ./configure
    make ; make install
    /usr/local/bin/memcached -u nobody -d -m 30 -l 127.0.0.1 -p 11211

// ----
<pre>
[root@ip-10-130-9-23 log]# cat /etc/fstab
#
LABEL=/     /           ext4    defaults,noatime  1   1
tmpfs       /dev/shm    tmpfs   defaults        0   0
devpts      /dev/pts    devpts  gid=5,mode=620  0   0
sysfs       /sys        sysfs   defaults        0   0
proc        /proc       proc    defaults        0   0
[root@ip-10-130-9-23 log]# cat /etc/mtab
/dev/xvda1 / ext4 rw,noatime 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0

</pre>

Protected: [收藏] Linux Embedded system step by steps – PDF / debian / linux booting steps

This post is password protected. To view it please enter your password below:


Ubuntu Linux : install .deb packages

sudo dpkg -i package_name

[monster] monster.tw 記錄 / memo / ubuntu / 裝 圖形介面 / GUI / gnome desktop / ip address / setting

昨天晚上去一位朋友公司幫忙用他們的 server , 回來就想要做幾件事:

1. 記錄一下自己的 server 某些重要檔案, 也可供其他人參考

2. 備份重要 file

3. 隨時準備好最新版的救援CD/Live CD/Live USB , 最新版的 Monster LAMP pack 也要燒好收著.

4. 準備一個 “萬用” 含各類 driver 的 linux kernel , 以供救援使用.

5. 搞懂 booting steps / GRUB setting


a93c35eaf5a0019c7f7a42f461dae3de

root@park:~# cat /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#              

proc            /proc           proc    defaults        0       0
# / was on /dev/sda1 during installation
UUID=46312252-8925-4e60-ab5f-af240b4b440f /               ext3    relatime,errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=bf9a64f1-3eb8-433c-8311-8d971be82dc2 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

service / daemon 管理工具

sysv-rc-conf text based utility :

sudo apt-get install sysv-rc-conf

另一套 GUI

sudo apt-get install gnome-system-tools

monster.tw 是裝這個 apt-get install rcconf

列出 runlevels 的 program : chkconfig

裝 圖形介面 / GUI / gnome desktop

sudo apt-get install ubuntu-desktop --no-install-recommends

啟動 desktop manager :

/etc/init.d/gdm start

stop x server / 關掉 x window: /etc/init.d/gdm stop

改 IP address

cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 172.30.0.42
        netmask 255.255.255.0
        network 172.30.0.0
        broadcast 172.30.0.255
        gateway 172.30.0.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 8.8.8.8
        dns-search monster.tw

重新啟動 networking
/etc/init.d/networking restart

若要使用 DHCP 的話

auto eth0
iface eth0 inet dhcp

加上 default route

gateway 1.2.3.4

或另一個 static route

up route add -net 1.2.3.0 netmask 255.255.255.0 gw 1.2.3.4

change host name:

改 /etc/hostname
改 /etc/hosts

若是用 vmware 之類的軟體導致 clone 出來的 ubuntu 網路 interface 跑掉, 可以砍掉
/etc/udev/rules.d/70-persistent-net.rules
後 reboot , 就可以解決了.

debian / ubuntu 裝 memcached 跟 pecl memcache

裝 memcached :

apt-get install memcached

/etc/default/memcached 裡面設 yes –> 啟用 設定檔 /etc/memcached.conf

裝 php5 的 memcache extension

apt-get install php5-memcache

會產生 /etc/php5/conf.d/memcache.ini 內容是

extension=memcache.so

[memcache]
memcache.dbpath="/var/lib/memcache"
memcache.maxreclevel=0
memcache.maxfiles=0
memcache.archivememlim=0
memcache.maxfilesize=0
memcache.maxratio=0

—– 以下是舊的方法, 2010.0630 前

裝 pecl memcache

aptitude install libevent-dev

因為 pecl 要用到 phpize , 所以要裝 php5-dev 套件

apt-get install php5-dev

apt-get install php-pear

pecl install memcache

裝好了, 要在 /etc/php5/conf.d 設一個檔 memcache.ini

cat > /etc/php5/conf.d/memcache.ini
extension=memcache.so

Protected: 兩個版本的 Linux ( CENTOS vs GENTOO ) 作 mysql + senna small compare

This post is password protected. To view it please enter your password below:


debian / ubuntu , APT HOWTO / Guide / 指令速查表

1. Searching for packages apt-cache
sudo apt-cache search package1

2. Getting more Information about a package apt-cache
sudo apt-cache show package1 package2 …

3. Installing a package apt-get install
sudo apt-get install package1 package2 …
sudo apt-get install package1 –reinstall

4. Removing packages apt-get remove
sudo apt-get remove package1 package2
complete remove:
sudo apt-get remove package1 package2 –purge

5. Update your package database apt-get update
sudo apt-get update

6. Upgrading your system apt-get [dist-]upgrade
sudo apt-get upgrade

The smart upgrade with:
sudo apt-get dist-upgrade

7. Resolving conflicts and Broken packages apt-get
sudo apt-get -f install

8. Checking for dependencies and reverse dependencies apt-cache
apt-cache depends package1 package2
apt-cache rdepends package1 package2

gentoo linux ifconfig

ifconfig eth0 ${IP_ADDR} broadcast ${BROADCAST} netmask ${NETMASK} up

[ubuntu] apache server module 的 enable / disable

a2enmod module_name

a2dismod module_name

重啟 apache : service apache2 restart

/etc/apache2/mods-available 下面有可用的 modules

Protected: vim 縮排設定

This post is password protected. To view it please enter your password below:


Ubuntu / LAMP / setup / install / package / apt-get install

URL : http://wiki.ubuntu-tw.org/index.php?title=Ubuntu_%E5%B8%B8%E7%94%A8%E8%BB%9F%E9%AB%94%E4%BB%8B%E7%B4%B9

service

用來啟動、停止和檢查這些 daemon 的狀態。例如:

* service –status-all => 列出目前所有 daemon 的狀態
* sudo service XXX start => 馬上啟動 XXX daemon
* sudo service XXX stop => 馬上關閉 XXX daemon
* service XXX status => 檢查 XXX 的狀態

rcconf

用來控制系統開機時是否要執行這些 daemon。例如:

* sudo rcconf –list => 列出目前所有 daemon 的啟動設定
* sudo rcconf –on XXX => 設定 XXX daemon 開機時自動啟動
* sudo rcconf –off XXX => 設定 XXX daemon 開機時不自動啟動

若你的系統沒有 rcconf 指令,請按以下方式安裝:

sudo apt-get install rcconf

讓Ubuntu指令自動加色彩 : http://nckuhuahua.pixnet.net/blog/post/29099339

LAMP 套件的apt指令
sudo apt-get install apache2 libapache2-mod-php5 php5 php5-gd mysql-server php5-mysql

sudo vi /etc/network/interfaces
sudo /etc/init.d/networking restart

 

———

apache settings ——->  /etc/apache2/sites-enabled

default apache document root —–> /var/www

 

Linux , /proc/cpuinfo , 參考表

硬體/廠牌/規格 /proc/cpuinfo , /proc/scsi/scsi
lazy.monster.tw
processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Xeon(R) CPU           E5420  @ 2.50GHz
stepping        : 8
cpu MHz         : 2491.990
cache size      : 6144 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss nx constant_tsc arch_perfmon pebs bts pni ssse3 sse4_1
bogomips        : 4989.02
clflush size    : 64
power management:

Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0
  Type:   Direct-Access                    ANSI  SCSI revision: 02
DELL 1950 , MEMORY 16G

(dbs)

processor       : 7
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Xeon(R) CPU           E5420  @ 2.50GHz
stepping        : 10
cpu MHz         : 2493.759
cache size      : 6144 KB
physical id     : 1
siblings        : 4
core id         : 7
cpu cores       : 4
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips        : 4987.52
clflush size    : 64
cache_alignment : 64
address sizes   : 38 bits physical, 48 bits virtual
power management:

Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: Dell     Model: Virtual  CDROM   Rev: 123
  Type:   CD-ROM                           ANSI SCSI revision: 02
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: Dell     Model: Virtual  Floppy  Rev: 123
  Type:   Direct-Access                    ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 32 Lun: 00
  Vendor: DP       Model: BACKPLANE        Rev: 1.05
  Type:   Enclosure                        ANSI SCSI revision: 05
Host: scsi2 Channel: 02 Id: 00 Lun: 00
  Vendor: DELL     Model: PERC 6/i         Rev: 1.21
  Type:   Direct-Access                    ANSI SCSI revision: 05
DELL OPTIPLEX 330

CORE 2 DUO

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Core(TM)2 Duo CPU     E4400  @ 2.00GHz
stepping        : 8
cpu MHz         : 1993.777
cache size      : 2048 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss nx constant_tsc up arch_perfmon pebs bts pni ssse3
bogomips        : 3997.16
clflush size    : 64
dev
processor       : 7
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Xeon(R) CPU           E5310  @ 1.60GHz
stepping        : 7
cpu MHz         : 1596.157
cache size      : 4096 KB
physical id     : 1
siblings        : 4
core id         : 3
cpu cores       : 4
apicid          : 7
initial apicid  : 7
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor ds_cpl vmx tm2 ssse3 cx16 xtpr pdcm dca lahf_lm tpr_shadow
bogomips        : 3192.12
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 08 Lun: 00
  Vendor: DP       Model: BACKPLANE        Rev: 1.00
  Type:   Enclosure                        ANSI  SCSI revision: 05
Host: scsi0 Channel: 02 Id: 00 Lun: 00
  Vendor: DELL     Model: PERC 5/i         Rev: 1.00
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Jack大的桌機之一

Intel Atom 330 @ 1.60GHz
現在變成我的 oasis
可以裝 OS X

processor	: 3
vendor_id	: GenuineIntel
cpu family	: 6
model		: 28
model name	: Intel(R) Atom(TM) CPU  330   @ 1.60GHz
stepping	: 2
cpu MHz		: 1596.052
cache size	: 512 KB
physical id	: 0
siblings	: 4
core id		: 1
cpu cores	: 2
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl tm2 ssse3 cx16 xtpr lahf_lm
bogomips	: 3192.11

scsi0 : ata_piix
scsi1 : ata_piix
scsi 0:0:0:0: Direct-Access     ATA      WDC WD1200BEVS-6 04.0 PQ: 0 ANSI: 5
sd 0:0:0:0: Attached scsi disk sda
sd 0:0:0:0: Attached scsi generic sg0 type 0

eth0: RTL8168b/8111b at 0xf8c26000, 00:30:1b:82:b8:xx, IRQ 16
monster
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 8
model name      : Pentium III (Coppermine)
stepping        : 1
cpu MHz         : 600.052
cache size      : 256 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips        : 1200.94
clflush size    : 32
阿毛的
processor       : 0
vendor_id       : CentaurHauls
cpu family      : 6
model           : 9
model name      : VIA Nehemiah
stepping        : 5
cpu MHz         : 733.194
cache size      : 64 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu de pse tsc msr cx8 mtrr pge cmov mmx fxsr sse rng rng_en
bogomips        : 1466.38
clflush size    : 32
power management:
new mysql db
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 26
model name      : Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz
stepping        : 5
cpu MHz         : 2261.096
cache size      : 8192 KB
physical id     : 1
siblings        : 8
core id         : 0
cpu cores       : 4
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc ida pni monitor ds_cpl vmx est tm2 cx16 xtpr popcnt lahf_lm
bogomips        : 4525.40
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:
dell 2950 dbs
processor       : 7
vendor_id       : GenuineIntel
cpu family      : 6
model           : 23
model name      : Intel(R) Xeon(R) CPU           E5420  @ 2.50GHz
stepping        : 10
cpu MHz         : 2493.748
cache size      : 6144 KB
physical id     : 1
siblings        : 4
core id         : 3
cpu cores       : 4
apicid          : 7
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
bogomips        : 4987.44
clflush size    : 64
cache_alignment : 64
address sizes   : 38 bits physical, 48 bits virtual
power management:

eth0: Broadcom NetXtreme II BCM5708 1000Base-T (B2) PCI-X 64-bit 133MHz found at mem f8000000, IRQ 169, node addr 0024e877c5d2

scsi5 : LSI SAS based MegaRAID driver
  Vendor: SEAGATE   Model: ST3146356SS       Rev: HS09
  Type:   Direct-Access                      ANSI SCSI revision: 05
  Vendor: SEAGATE   Model: ST3146356SS       Rev: HS09
  Type:   Direct-Access                      ANSI SCSI revision: 05
  Vendor: SEAGATE   Model: ST3146356SS       Rev: HS09
  Type:   Direct-Access                      ANSI SCSI revision: 05
  Vendor: SEAGATE   Model: ST3146356SS       Rev: HS09
  Type:   Direct-Access                      ANSI SCSI revision: 05
  Vendor: SEAGATE   Model: ST3146356SS       Rev: HS09
  Type:   Direct-Access                      ANSI SCSI revision: 05
  Vendor: SEAGATE   Model: ST3146356SS       Rev: HS09
  Type:   Direct-Access                      ANSI SCSI revision: 05
  Vendor: DP        Model: BACKPLANE         Rev: 1.05
  Type:   Enclosure                          ANSI SCSI revision: 05
scsi 5:0:32:0: Attached scsi generic sg4 type 13
  Vendor: DELL      Model: PERC 6/i          Rev: 1.21
  Type:   Direct-Access                      ANSI SCSI revision: 05

各種 file system 的大比較表

不過想想, 因為可用的 OS 實在是不多 , Linux , Solaris , FreeBSD , 刪一刪似乎適合的 file system 答案也就出現了

http://en.wikipedia.org/wiki/Comparison_of_file_systems

另外有大大作了 file system 實戰的 lab , 可以參考看看:

http://tetralet.luna.com.tw/index.php?op=ViewArticle&articleId=214&blogId=1

CENTOS 改 keyboard mapping

system-config-keyboard

改 IP address

工具 : system-config-network

或改 /etc/sysconfig/network-scripts/ifcfg-eth0 檔案

改完後, 下
/etc/init.d/network restart

service network restart

—–

centos 改 init.d 的 run level 的方法: chkconfig

列出 各 service :

chkconfig –list

vmware esx server – compile linux kernel / scsi controller/driver problem

直接在 vmware esx server 上重裝一台 gentoo linux 的 steps

在這個地方要勾 BusLogic , 在 make menuconfig 要選 BusLogic (簡直是廢話…)

9501eebd2a93f31b580498868083c8ba

開機後 dmesg | grep scsi 的結果是

scsi: ***** BusLogic SCSI Driver Version 2.1.16 of 18 July 2002 *****
scsi: Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
scsi0: Configuring BusLogic Model BT-958 PCI Wide Ultra SCSI Host Adapter
scsi0:   Firmware Version: 5.07B, I/O Address: 0×1060, IRQ Channel: 17/Level
scsi0:   PCI Bus: 0, Device: 16, Address: 0xF4800000, Host Adapter SCSI ID: 7
scsi0:   Parity Checking: Enabled, Extended Translation: Enabled
scsi0:   Synchronous Negotiation: Ultra, Wide Negotiation: Enabled
scsi0:   Disconnect/Reconnect: Enabled, Tagged Queuing: Enabled
scsi0:   Scatter/Gather Limit: 128 of 128 segments, Mailboxes: 211
scsi0:   Driver Queue Depth: 211, Host Adapter Queue Depth: 192
scsi0:   Tagged Queue Depth: Automatic, Untagged Queue Depth: 3
scsi0: *** BusLogic BT-958 Initialized Successfully ***
scsi0 : BusLogic BT-958
scsi 0:0:0:0: Direct-Access     VMware   Virtual disk     1.0  PQ: 0 ANSI: 2
sd 0:0:0:0: Attached scsi generic sg0 type 0

sysctl / Linux tunning /etc/sysctl.conf

net.ipv4.ip_local_port_range = 1024 65536
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.ipv4.tcp_fin_timeout = 3
net.ipv4.tcp_tw_recycle = 1
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_no_metrics_save=1
net.core.somaxconn = 262144
net.ipv4.tcp_syncookies = 0
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2

解決 error while loading shared libraries 的方法

執行程式時, 若遇到

./update_item: error while loading shared libraries: libsqlrclientwrapper-0.40.so.1: cannot open shared object file: No such file or directory

像這樣的錯誤訊息 , 表示程式中所需的 so 檔(share library) 沒找到 , 要修改 /etc/ld.so.conf 加上這個目錄 , 改完要下 ldconfig –v 讓路徑生效

可以用 ldd 看該程式所使用到的 shared library 有那些, 及 lib 路徑

—–

以下是 gentoo 的標準解法 , 其他版本的 linux 則不太相同!!

cat /etc/ld.so.conf   這個檔是由 env-update 產生的 , 所以再繼續看一下 /etc/env.d 下 , 究竟有啥

# ld.so.conf autogenerated by env-update; make all changes to
# contents of /etc/env.d directory
/usr/local/lib
/usr/i686-pc-linux-gnu/lib
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2
/usr/lib/gcc/i686-pc-linux-gnu/4.1.1
/usr/local/firstworks/lib

參考資料, 這是 compile sqlrelay 列出來的 information

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

———————————————————————-

/bin/sh ../../libtool –mode=finish /usr/local/firstworks/lib

PATH=”$PATH:/sbin” ldconfig -n /usr/local/firstworks/lib

———————————————————————-

Libraries have been installed in:

/usr/local/firstworks/lib

If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR’

flag during linking and do at least one of the following:

- add LIBDIR to the `LD_LIBRARY_PATH’ environment variable

during execution

- add LIBDIR to the `LD_RUN_PATH’ environment variable

during linking

- use the `-Wl,–rpath -Wl,LIBDIR’ linker flag

- have your system administrator add LIBDIR to `/etc/ld.so.conf’

在 /etc/env.d 下建立一個 90sqlrelay

內容是

LDPATH="/usr/local/firstworks/lib"

再run : env-update , 就看到 /etc/ld.so.conf 多了正確的 lib path 了

Protected: [ruten] memcache usage

This post is password protected. To view it please enter your password below: