Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
my.sh
###修改ubuntu初始密码
#sudo passwd root
###修改主机名 
#/etc/hostname
#/etc/hosts
###安装ssh服务
#sudo apt-get install openssh-server
###ssh 登入
#ssh -p 22 -l root 192.168.0.154
###安装vmtools 解压后文件路径不能有空格 | 安装后启动
#./vmware-install.pl
#vmware-user
###ubuntn 版本升级
#sudo update-manager -d
###Ubuntu 更新源签名错误 –BADSIG 40976EAF437D05B5
#sudo aptitude -o Acquire::http::No-Cache=True -o Acquire::BrokenProxy=true update
###终极大法
#sudo apt-get clean
#cd /var/lib/apt
#sudo mv lists lists.old
#sudo mkdir -p lists/partial
#sudo apt-get clean
#sudo apt-get update
### 清除缓存
#sudo /etc/init.d/dns-clean start
###deb文件安装
#dpkg -i XXX.deb
###无法获得锁/var/lib/dpkg/lock的解决发方法
##两种情况
##先看到底有没开两个apt
##如果确定没开两个APT-GET
#sudo rm /var/lib/dpkg/lock
##这样就删除了锁文件,然后运行
#sudo dpkg --configure -a
##重新配置
###安装mysql图形工具 先安装依赖包
#apt-get install libctemplate0 liblua5.1-0 libzip1 python-paramiko python-pysqlite2
#dpkg -i mysql-workbench-gpl-5.2.35-1ubu1004-i386.deb
###安装jdk
#./jdk-6u27-ea-bin-b03-linux-i586-27_may_2011.bin
###配置环境变量(所有用户) su - user 中间加上 - 才能把环境变量也切换过去
#vi /etc/profile.d/java.sh
#JAVA_HOME=... CLASSPATH=... PATH=...
#export JAVA_HOME CLASSPATH PATH
#chmod 755 /etc/profile.d/java.sh
###安装ruby
#apt-get install build-essential bison openssl libreadline6 libreadline6-dev
##curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev
##libxslt-dev autoconf libc6-dev ncurses-dev
#apt-get install git-core
#apt-get install sqlite3 libsqlite3-dev
#gem install sqlite3 --no-ri --no-rdoc
#gem install rails --no-ri --no-rdoc
#gem ‘execjs’
#gem ‘therubyracer’
###安装nginx
#pcre模块
#wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.tar.gz
#wget http://launchpadlibrarian.net/33465361/libpcre3_7.8-3_i386.deb
#dpkg -i http://launchpadlibrarian.net/33465361/libpcre3_7.8-3_i386.deb
###pid位置根据./configure时查看
#start-stop-daemon --stop --quiet --pidfile /usr/local/nginx/nginx.pid --exec /usr/local/nginx/sbin/nginx || true
#chmod +x /etc/init.d/nginx
#update-rc.d nginx defaults
#update-rc.d -f nginx remove
#/etc/init.d/nginx configtest
###安装一堆tomcat
#sudo -i 改变文件权限
#chmod 777 -R file
#chmod 4777 -R file
###传送文件 -r 递归 -C 压缩
#scp -r -C user@ip:/location user@ip:/location
###scp 不用输密码
# ssh-keygen -t rsa
# chmod 755 ~/.ssh
# scp -r ~/.ssh/id_rsa.pub 192.168.65.128:/root/.ssh/authorized_keys
###在以普通用户打开的VIM当中以root保存
#:w !sudo tee %
###启动svn
#sudo svnserve -d --foreground -r /home/svn
###主机名访问svn
#sudo apt-get install samba
###登入mysql
#mysql -u root -pEnter
###升级后grub损坏 修复 http://lengyue318.iteye.com/blog/1109990
#grub>ls //注释:会显示出 (hd0,1) (hd0,2)
#grub>ls (hd0,1)/ //注释:依次打开 直到能打开为止 记住这个名字
#grub>root (hd0,1)
#grub>linux /boot/vmlinuzxxxxxxxxx (tab补全即可) root=/dev/sda1 //注释:这里sda1对应的是(hd0,1),vmlinuzxxxxxxx对应的是加载的linux内核
#grub>initrd /boot/initrd.imgxxxxxxxxxxxx(tab 补全即可) //注释:内核所对应的图片
#grub>boot
###以root用户执行如下:
#update-grub2
#reboot
###iptables端口映射 80端口转发到9080
#sysctl net.ipv4.ip_forward ## 0 关闭 1 开启
#sudo sysctl net.ipv4.ip_forward=1
#sudo iptables -P FORWARD DROP
#sudo iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
#sudo iptables -t nat -A PREROUTING -d 192.168.0.105 -p tcp --dport 80 -j DNAT --to 192.168.0.105:9080
#sudo iptables -A FORWARD -d 192.168.0.105 -p tcp --dport 9080 -j ACCEPT
#sudo iptables -t nat -A POSTROUTING -d 192.168.0.105 -p tcp --dport 9080 -j SNAT --to 192.168.0.1
#sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 9080
#iptables -t nat -A PREROUTING -p tcp -m tcp --dport 443 -j DNAT --to-destination 199.59.149.200:443
#iptables -t nat -A POSTROUTING -p tcp -m tcp --dport 443 -j SNAT --to-source $YOUR_VPS_IP
###Linux下Sublime Text 2中文显示及中文输入问题
#http://www.cnblogs.com/xfiver/archive/2012/02/23/2365560.html
###linux终端快捷键
#http://56553655.iteye.com/blog/722477
###解决gedit的乱码问题
#http://www.byvoid.com/blog/gedit-encoding/
###ubuntu添加gb18030等中文编码的支持
#http://archive.cnblogs.com/a/1907212/
###Ubuntu安装雅黑字体
#http://www.cnblogs.com/mamboer/archive/2011/03/26/ubuntu-yahei.html
### gedit乱码 当前用户和root http://xiaotanglinux.blog.51cto.com/694236/404812
#http://forum.ubuntu.org.cn/viewtopic.php?t=227562
##有些人虽然跟楼主做了一样的动作,可是仍然乱码——像我 ,然后找到另外的一个方法,终于解决了,我也写下来,然后收藏下吧
#执行 sudo vim /var/lib/locales/supported.d/zh-hans
#加入以下配置参数
#zh_CN.GB18030 GB18030
#zh_CN.GBK GBK
#zh_CN.GB2312 GB2312
#zh_HK.BIG5 BIG5
#zh_TW.BIG5 BIG5
#然后执行 sudo locale-gen
#提示以下信息,成功了(可能比较慢,耐心等待)
#zh_CN.GB18030… done
#zh_CN.GBK… done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.