linux开发环境搭建

//安装中文输入法
yum install "@Chinese Support"

//编译安装GIT准备

yum -y install zlib-devel openssl-devel perl cpio expat-devel gettext-devel openssl zlib curl autoconf tk


//从GOOGLE上下载最新版本GIT代码

wget http://git-core.googlecode.com/files/git-1.9.0.tar.gz


//安装GIT
tar zxf git-1.9.0.tar.gz
cd git-1.9.0
autoconf
./configure
make(编译失败  提示是perl的问题,用yum search perl)

yum search perl-devel
yum install perl-devel.i686(还需要安装x86_64版本)

make install

git --version


//配置GIT
cd ~/.ssh    //检查计算机ssh密钥

生成ssh key(使用系统推荐的名字)
ssh-keygen -t rsa -C "[email protected]"

测试ssh key是否成功
ssh -T [email protected]

git config --global user.name "xxxxxxxxx"
git config --global user.email  "[email protected]"

git config --global github.user xxxxx
git config --global github.token zeeeeykd5TwCfeeestajcn

//下载工程代码库
git clone [email protected]:xxxxxx/server.git

//安装libevent
tar zxvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
make install

//安装成功:

----------------------------------------------------------------------

Libraries have been installed in:
   /usr/libevent/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'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
//下载安装zeromq
yum install libtool
yum install gcc
yum install gcc-c++
yum install make
yum install libuuid-devel

wget http://download.zeromq.org/zeromq-4.0.4.tar.gz
tar zxf zeromq-4.0.4.tar.gz
cd zeromq-4.0.4
./configure -prefix=/usr/zeromq
make
make install
//设置环境变量
export CPPFLAGS=-I/usr/zeromq/include/
export LDFLAGS=-L/usr/zeromq/lib/
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/zeromq/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'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

vim /etc/ld.so.conf //增加库目录 usr/local/lib

//安装eclipse

yum search jdk

yum install java-1.7.0-openjdk-devel.x86_64

tar -zxvf eclipse-cpp-kepler-SR2-linux-gtk-x86_64.tar.gz  //双击启动


//文件夹 文件访问权限更改

chmod a+w qserver
chmod -R 777 *
man 7 pthreads

yum install glibc.i686


//安装宋体:
cd /usr/share/fonts/chinese/simsun
mkfontscale
mkfontdir
fc-cache -fv

iptables -L
/etc/init.d/iptables stop
chkconfig iptables off


//Git问题解决

1  rm .git/objects/c6/884991eaac39417e314faa6685061eab18909d

2 .git fsck --full

3.git reflog

//性能分析工具:
top time timex free ps vmstat

//内存检测:

yum install valgrind

valgrind --leak-check=full ./qserver

  1、memcheck:检查程序中的内存问题,如泄漏、越界、非法指针等。

    2、callgrind:检测程序代码的运行时间和调用过程,以及分析程序性能。

    3、cachegrind:分析CPU的cache命中率、丢失率,用于进行代码优化。

    4、helgrind:用于检查多线程程序的竞态条件。

    5、massif:堆栈分析器,指示程序中使用了多少堆内存等信息。

    6、lackey:

    7、nulgrind:

这几个工具的使用是通过命令:valgrand --tool=name 程序名来分别调用的,当不指定tool参数时默认是 --tool=memcheck

//内存泄漏检测
valgrind --leak-check=full --show-reachable=yes --track-origins=yes ./qserver

//关系图生成 cache剖析器  Graphviz ; gprof2dot.py放在/usr/bin下
valgrind --tool=callgrind ./qserver
gprof2dot.py -f callgrind callgrind.out.5308 |dot -T png -o report.png

//C++性能测试工具 gprof + kprof + gprof2dot

yum install graphvizgraphviz


//ftp服务器
yum install vsftpd

//ftp安装检测
rpm -q vsftpd

mkdir /tmp/zjc
adduser -d /tmp/zjc -g ftp -s /sbin/nologin zjc
passwd zjc
service vsftpd restart
ftp://192.168.1.13/
//查看开关
getsebool -a | grep ftp
//开机自动启动
chkconfig vsftpd on



setsebool allow_ftpd_full_access 1
setsebool allow_ftpd_use_cifs 1
setsebool allow_ftpd_use_nfs 1
setsebool -P ftp_home_dir 1
setsebool httpd_enable_ftp_server 1
setsebool tftp_anon_write 1
service vsftpd restart

你可能感兴趣的:(linux开发环境搭建)