22 февр. 2012 г.

Установка C, C++ в Ubuntu

Если вы разработчик и программируете на C или C++, то необходимо установить компилятор с помощью build-essentials:
# sudo aptitude install build-essential Установятся все необходимые пакеты для C и C++ компиляторов.

Проверим компилятор С:
# vi first.c #include <stdio.h>
int main ()
{
   printf("Hello, world\n");
   return 0;
}
Скомпилируем код с помощью следующей комманды: # cc -c first.c Это создаст объект, который вы можете добывить в библиотеку.
Затем создадим исполняемый файл: # cc -o first first.c Что бы запустить программу запишем следующее: # ./first Результатом должно быть: Hello, world
Проверим C++ компилятор:
Если вы хотите запустить программу C++, то необходимо использовать компилятор g++. Расширение должно быть .cpp.
Создадим файл: # vi first.cpp #include <iostream>
int main ()
{
   std::cout << "Hello world!" << std::endl;
   return 0;
}
Создадим исполняемый файл: # g++ first.cpp -o test Запускается программа точно так же как и в случае с С: # ./test Результат должен выглядеть так: Hello World!
Оба компилятоа установлены и работают.

9 февр. 2012 г.

Apache, php, mysql на CentOS

Задача:
Есть сервер CentOS с доступом по ssh. Необходимо установить apache, php, mysql со всеми обновлениями.
Для решения задачи используется только putty для подключения через ssh.

Вступление и подготовка
Для проверки работы apache и php установим консольный браузер lynx
# yum install lynx Если в системе нету файла hosts:
добавить его в /etc со следующим содержимым:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

8 февр. 2012 г.

Dropbox console for CentOS

How to install dropbox on your linux server (console mode)

1. Download http://www.getdropbox.com/download?plat=lnx.x86 or http://www.getdropbox.com/download?plat=lnx.x86_64

2. Extract tar.gz file downloaded and leave in root home folder

3. Run
~/.dropbox-dist/dropboxd to get Dropbox to provide a URL to go to in your browser to link this computer to your Dropbox account

4. After visiting the URL in a browser to which you've logged into dropbox.com, you'll see message smth like: Successfully linked etc.

4 февр. 2012 г.

Grub Customizer

Grub Customizer software is for editing the boot loader menu GRUB2


Grub Customizer - this is a new settings manager for GRUB2 on the GUI. At the moment it can: rename, reorder, remove, add or hide the menu items select the bootloader.
More interesting is the fact that even after reinstalling the crudest your changes do not disappear.

Grub Customizer is available through the Ubuntu PPA (Lucid and Maverick) # sudo add-apt-repository ppa: danielrichter2007/grub-customizer
# sudo apt-get update
# sudo apt-get
# install grub-customizer
It also supports BURG.

ERROR "sudo: sorry, you must have a tty to run sudo"

The reason for this is an update along the way with sudo locked it down further by adding the below line to /etc/sudoers configuration file. 1 Defaults requiretty To allow a remote script to login and run a command via sudo simply comment out that line as shown below. 1   # Commented out so remote script can login and run a command without a tty
2   # Defaults requiretty
If requiretty is set, sudo will only run when the user is logged in to a real tty. This will disallow things like 'rsh somehost sudo ls' since rsh does not allocate a tty; because it is not possible to turn off echo when there is no tty present.